[uploader] fix race condition where upload would not finish