parameters: (self)
docstring: 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.
docstring_summary: Flush and close the file.
docstring_tokens: Flush and close the file .
function: 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
function_tokens: 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