Add automatic write of config file