Modified config saving to be safer

Now saves multiple (default 3) backups of existing config files
Also saves to temp file, then replaces config file with it