Closing procedure fixed, isConnected removed