Figure worth a try. I sleep for 5 seconds, however should be able to tell if this is the issue by stepping thought the code, and before you hit that line just wait for a little bit. View what the GUI looks like - then let it run.
Might point something out at least.