def connectionLost(self, reason):
        abstract.FileDescriptor.connectionLost(self, reason)
        os.close(self.fd)
        self.lostProcess += 1
        self.maybeCallProcessEnded()
I call this to clean up when one or all of my connections has died.
dataset/ETHPy150Open twisted/twisted/twisted/internet/process.py/PTYProcess.connectionLost