def connectionLost(self, reason):
        """
        Clean all opened files and directories.
        """
        for fileObj in self.openFiles.values():
            fileObj.close()
        self.openFiles = {}
        for (dirObj, dirIter) in self.openDirs.values():
            dirObj.close()
        self.openDirs = {}

        Clean all opened files and directories.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/filetransfer.py