Added two safe-guards against exiting program while saving a file, so the file is only partially saved.

Renamed file endings of saved files to *.saf for second agent files and *.lsmpop for the LSM population file.