code: func (fm *filesManager) closeLockedFile(file *file) error {
  	if !atomic.CompareAndSwapInt32(&file.state, fileInUse, fileClosing) {
  		panic(fmt.Errorf("file %q is requested to be closed but was not locked by caller", file.name))
  	}
  	fm.Lock()
  	err := fm.doClose(file)
  	fm.Unlock()
  	return err
  }
docs: // closeLockedFile closes the handle of the given file, but only if the caller
  // has locked the file. Will panic otherwise.
  // If the file's beforeClose callback is not nil, this callback is invoked
  // before the file handle is closed.