Adding a pull down resistor to the signal input (TC4427 pin 2) seems to fix the problem. I was erroneously assuming that the atmega328 had internal pull down resistors. It only has a pull up resistor. So digitalWrite(3, LOW); isn't low enough. Seems to be the same as leaving the pin floating.