docs: def Close(self):
      """Close and destroy the object.
  
      This is similar to Flush, but does not maintain object validity. Hence the
      object should not be interacted with after Close().
  
      Raises:
         LockError: The lease for this object has expired.
      """
      if self.locked and self.CheckLease() == 0:
        raise LockError("Can not update lease that has already expired.")
  
      self._WriteAttributes()
  
      # Releasing this lock allows another thread to own it.
      if self.locked:
        self.transaction.Release()
  
      if self.parent:
        self.parent.Close()
  
      # Interacting with a closed object is a bug. We need to catch this ASAP so
      # we remove all mode permissions from this object.
      self.mode = ""