code: def Close(self):
      
      if not self._is_open:
        raise IOError('Storage file already closed.')
  
      if not self._read_only:
        self._WriteSerializedAttributeContainerList(
            self._CONTAINER_TYPE_EVENT_SOURCE)
        self._WriteSerializedAttributeContainerList(
            self._CONTAINER_TYPE_EVENT_DATA)
        self._WriteSerializedAttributeContainerList(self._CONTAINER_TYPE_EVENT)
        self._WriteSerializedAttributeContainerList(
            self._CONTAINER_TYPE_EVENT_TAG)
        self._WriteSerializedAttributeContainerList(
            self._CONTAINER_TYPE_EXTRACTION_WARNING)
  
      if self._connection:
        # We need to run commit or not all data is stored in the database.
        self._connection.commit()
        self._connection.close()
  
        self._connection = None
        self._cursor = None
  
      self._is_open = False
docs: Closes the storage.
  
      Raises:
        IOError: if the storage file is already closed.
        OSError: if the storage file is already closed.