detect if upload is finished or not, and actually finish it