code: def close(self):
          
          self.lock.acquire()
          try:
              # only close the pipe when the user explicitly closes the channel.
              # otherwise they will get unpleasant surprises.  (and do it before
              # checking self.closed, since the remote host may have already
              # closed the connection.)
              if self._pipe is not None:
                  self._pipe.close()
                  self._pipe = None
  
              if not self.active or self.closed:
                  return
              msgs = self._close_internal()
          finally:
              self.lock.release()
          for m in msgs:
              if m is not None:
                  self.transport._send_user_message(m)
docs: Close the channel.  All future read/write operations on the channel
          will fail.  The remote end will receive no more data (after queued data
          is flushed).  Channels are automatically closed when their `.Transport`
          is closed or when they are garbage collected.