Fixed save state for both OS shutdowns and user shutdowns.