code: func (w *wrapper) Save() error {
  	w.mut.Lock()
  	defer w.mut.Unlock()
  
  	fd, err := osutil.CreateAtomic(w.path)
  	if err != nil {
  		l.Debugln("CreateAtomic:", err)
  		return err
  	}
  
  	if err := w.cfg.WriteXML(fd); err != nil {
  		l.Debugln("WriteXML:", err)
  		fd.Close()
  		return err
  	}
  
  	if err := fd.Close(); err != nil {
  		l.Debugln("Close:", err)
  		return err
  	}
  
  	events.Default.Log(events.ConfigSaved, w.cfg)
  	return nil
  }
docs: // Save writes the configuration to disk, and generates a ConfigSaved event.