code: func (fm *filesManager) doClose(file *file) error {
  	var err error
  	if file.beforeClose != nil {
  		err = file.beforeClose()
  	}
  	util.CloseFile(err, file.handle)
  	// Regardless of error, we need to change the state to closed.
  	file.handle = nil
  	atomic.StoreInt32(&file.state, fileClosed)
  	fm.openedFDs--
  	return err
  }
docs: // doClose closes the file handle, setting it to nil and switching state to `fileClosed`.
  // If a `beforeClose` callback was registered on file creation, it is invoked
  // before the file handler is actually closed.
  // Lock is required on entry.