Fix scope, ressource leaks in boostrap daemon

Reduce scope of config_setting_t *elem

Fix various leaks of files keys_file and pid_file