Added error protection to safe restart tool