cleaning up the connection between client and server