'Close this stream.
If ``exc_info`` is true, set the ``error`` attribute to the current
exception from `sys.exc_info` (or if ``exc_info`` is a tuple,
use that instead of `sys.exc_info`).'

def close(self, exc_info=False):

    if (not self.closed()):
        if exc_info:
            if (not isinstance(exc_info, tuple)):
                exc_info = sys.exc_info()
            if any(exc_info):
                self.error = exc_info[1]
        if self._read_until_close:
            if ((self._streaming_callback is not None) and self._read_buffer_size):
                self._run_read_callback(self._read_buffer_size, True)
            self._read_until_close = False
            self._run_read_callback(self._read_buffer_size, False)
        if (self._state is not None):
            self.io_loop.remove_handler(self.fileno())
            self._state = None
        self.close_fd()
        self._closed = True
    self._maybe_run_close_callback()
