Moved all keys.dat writing code into writeKeysFile in shared.py
Added backup copy creation during keys.dat write to prevent an accidental file loss due to the disk failure.
TImestamped the keys.dat backup file.
resolve merge conflict
fix bug in #715
Merge pull request #752 from Atheros1/master

Backup keys.dat before writing