Error handling for config save and global cleanup