Implemented socket.close() for closing down the connection