I feel like an idiot now. It had nothing to do with the thread or switching tasks or none of that. It had to do with the upload timing out. For instance, if the file was too big that upload would timeout and cause the upload to stop. I was able to fix this by calling a set timeout function for my upload.