(self)
Close the file, and for mode 'w', 'x' and 'a' write the ending
        records.
Close the file, and for mode 'w', 'x' and 'a' write the ending
        records.
Close the file and for mode w x and a write the ending records .
def close(self):
        """Close the file, and for mode 'w', 'x' and 'a' write the ending
        records."""
        if self.fp is None:
            return

        if self._writing:
            raise ValueError("Can't close the ZIP file while there is "
                             "an open writing handle on it. "
                             "Close the writing handle before closing the zip.")

        try:
            if self.mode in ('w', 'x', 'a') and self._didModify: # write ending records
                with self._lock:
                    if self._seekable:
                        self.fp.seek(self.start_dir)
                    self._write_end_record()
        finally:
            fp = self.fp
            self.fp = None
            self._fpclose(fp)
def close ( self ) : if self . fp is None : return if self . _writing : raise ValueError ( "Can't close the ZIP file while there is " "an open writing handle on it. " "Close the writing handle before closing the zip." ) try : if self . mode in ( 'w' , 'x' , 'a' ) and self . _didModify : # write ending records with self . _lock : if self . _seekable : self . fp . seek ( self . start_dir ) self . _write_end_record ( ) finally : fp = self . fp self . fp = None self . _fpclose ( fp )