pub fn save(state: &Value) -> Result<(), String>
Write the state file, creating its directory and restricting it to its owner.