(self)
Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
Flush and close the file.
Flush and close the file .
def close(self):
        """Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
        """
        if self._mode == _MODE_CLOSED:
            return
        try:
            if self._mode == _MODE_READ:
                self._buffer.close()
                self._buffer = None
            elif self._mode == _MODE_WRITE:
                self._fp.write(self._compressor.flush())
                self._compressor = None
        finally:
            try:
                if self._closefp:
                    self._fp.close()
            finally:
                self._fp = None
                self._closefp = False
                self._mode = _MODE_CLOSED
def close ( self ) : if self . _mode == _MODE_CLOSED : return try : if self . _mode == _MODE_READ : self . _buffer . close ( ) self . _buffer = None elif self . _mode == _MODE_WRITE : self . _fp . write ( self . _compressor . flush ( ) ) self . _compressor = None finally : try : if self . _closefp : self . _fp . close ( ) finally : self . _fp = None self . _closefp = False self . _mode = _MODE_CLOSED