Moved closing client socket to finally block in KVStore
Extracted sendReply method and added missing sendReply call when exception is thrown