I beleive your issue is computer settings for power saving. You need to modify those so the computer doesnt sleep or shut off USB etc. Also you can download an App called Mouse Move that makes your computer think you are actively moving the mouse. Simply turn it on when you run your program.