def closed(self):
        if self.protocol:
            self.protocol.connectionLost("disconnected")
            self.protocol = None
this is reliably called on both logout and disconnect
dataset/ETHPy150Open cowrie/cowrie/cowrie/ssh/session.py/SSHSessionForCowrieUser.closed