No longer writing to JSON files in place

There have been some issues with snapshot corruption, which very well may have been due to the fact that we are writing to it in place. Just to be safe, writing to both the snapshot and the manifest file now is accomplished by writing to a temporary file and then moving it to replace the original.