Add shutdown hook to close client connection.