pub(crate) fn prepare_for_write() -> Result<()>
A few process changes that need to be made for writing. IMPORTANT: This may end up re-executing the current process, so anything that happens before this should be idempotent.