'Close this stream.'

def close(self, linger=None):

    if (self.socket is not None):
        self.io_loop.remove_handler(self.socket)
        self.socket.close(linger)
        self.socket = None
        if self._close_callback:
            self._run_callback(self._close_callback)
