Synchronized the uploads with a semaphore