If the state file exists, replace it, otherwise just create it.