code: def close(self):
      
      if not self._is_open:
        raise IOError('Not opened.')
  
      if not self._is_cached:
        close_file_object = True
      elif self._resolver_context.ReleaseFileObject(self):
        self._is_cached = False
        close_file_object = True
      else:
        close_file_object = False
  
      if close_file_object:
        self._Close()
        self._is_open = False
docs: Closes the file-like object.
  
      Raises:
        IOError: if the file-like object was not opened or the close failed.
        OSError: if the file-like object was not opened or the close failed.