config save and cleanup