def METHOD_NAME(self):
    if hasattr(self, "file"):
        self.file.flush()
        self.file.METHOD_NAME()
        self.closed = self.file.closed
        del self.file
    else:
        self.closed = 1