Fixed a NullPointerException when closing client socket.