def connectionLost(self, reason):
        """
        I call this to clean up when one or all of my connections has died.
        """
        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.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/process.py