Create the config directory before writing to config file