fix problem(when closing a connection)