remove SyncLock and fix memory leak while closing connections during file uploads, make connection state explicit