client: close the socket on termination