code: func (s *Filesystem) Unlock(id string) error {
  	defer s.mutex()()
  
  	if s.lockID == "" {
  		return fmt.Errorf("LocalState not locked")
  	}
  
  	if id != s.lockID {
  		idErr := fmt.Errorf("invalid lock id: %q. current id: %q", id, s.lockID)
  		info, err := s.lockInfo()
  		if err != nil {
  			err = multierror.Append(idErr, err)
  		}
  
  		return &LockError{
  			Err:  idErr,
  			Info: info,
  		}
  	}
  
  	lockInfoPath := s.lockInfoPath()
  	log.Printf("[TRACE] statemgr.Filesystem: removing lock metadata file %s", lockInfoPath)
  	os.Remove(lockInfoPath)
  
  	fileName := s.stateFileOut.Name()
  
  	unlockErr := s.unlock()
  
  	s.stateFileOut.Close()
  	s.stateFileOut = nil
  	s.lockID = ""
  
  	// clean up the state file if we created it an never wrote to it
  	stat, err := os.Stat(fileName)
  	if err == nil && stat.Size() == 0 && s.created {
  		os.Remove(fileName)
  	}
  
  	return unlockErr
  }
docs: // Unlock is the companion to Lock, completing the implemention of Locker.