pub fn save_config(config: &Config) -> Result<()>
Save configuration to the config file
Creates a backup of the existing config (config.json.bak) before overwriting. Ensures the config directory exists.