<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _close(self):
 """ Close the file if it was created by the writer. If a buffer or file-like object was passed in, for example a GzipFile, then leave this file open for the caller to close. In either case, attempt to flush the file contents to ensure they are written to disk (if supported) """

        # Some file-like objects might not support flush
        try:
            self._file.flush()
        except AttributeError:
            pass
        if self._own_file:
            self._file.close()