Corrected upload of files of unknown size
wait till all threads join in a correct way