Unwanted shut down of outputs.

You do know that opening and closing the serial monitor resets your arduino.

I still don't see how you know it is reaseting. Maybe you have a faulty USB cable.