docs: def clear(self):
          """Close all opened files if not in use."""
          with self.lock:
              for filehandle, refcount in list(self.files.items()):
                  if refcount == 0:
                      filehandle.close()
                      del self.files[filehandle]
                      del self.past[self.past.index(filehandle)]