make json persistent storage survive unexpected shutdowns
The update process is not atomic or journaled, and could potentially lose data if the process is killed when the save in progress. To make the matter worse, save happens automatically and there is no graceful shutdown procedure. In the very unlikely case, the save file maybe corrupted after a restart or update. This can be fixed with creating a file with a random file name, fill its content, and then rename the old file and new file to swap their position, before deleting the old file. But maybe we don't need it.
(from: !296 (comment 3022843))