making close connection synchronised