Fixed connection race condition dead lock.
Thread safe disconnections