def closed(self):
        """
        When the channel closes, deliver disconnection notification to the
        protocol.
        """
        self._creator.cleanupConnection(self.conn, False)
        if self._reason is None:
            reason = ConnectionDone("ssh channel closed")
        else:
            reason = self._reason
        self._protocol.connectionLost(Failure(reason))

        When the channel closes, deliver disconnection notification to the
        protocol.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/endpoints.py