First step of the resume feature from #24.

Ok, it seems `w+` will erase the file before opening it so this is definitely not what we want.