I don't believe that is your entire code. You are obviously jumping around to update your progressbar but you don't show how in your posted code.

Strip the code down to the bare essentials and run it as a separate test script in debug.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.