Write configuration files before stopping services