fixed logic mistake
added closing connection by message