write config file at the end of the program