WIP: write saveState to disk