Ivar showed that the "loading filename..." message in the script editor can clobber the data file. I've seen this message get stuck before, but I thought it wasn't ever associated with a filename and couldn't damage the file.
Fortunately, Ivar still had the script in an emacs editor, otherwise he could have lost his work.
I've cleared the current file before setting the message. It must be there's a way to break out of those lines of code leaving the file name set and the "loading filename..." message in the editor, which would be easily to accidentally save. This should take care of that problem.