Fix issue in persistent storage

Do not keep appending to the same storage file, as loading from it will
not work as expected.  Instead, re-open the file on every write.
Additionally, start by making a backup copy before re-writing the file,
to minimize the possibility of data loss.