Sometimes when I click on the 'tool' menu, my arduino will send all of the digital and analog pins high. I do not know why it does this, but if I forgot to unplug some of my components, it will fry them because they are designed to pulse through hexfets 10-50ms @ 2Amps, not stay on for 3-5 seconds at 2Amps!
Possibly you are resetting the Arduino via the auto-reset feature of the Arduino IDE? If that is it, then all your pins go to input mode, floating. A possible solution for your mosfets turning on in that condition is to wire a pull down resistor between the gates and source terminals. say 10k ohm.