Added code to shutdown device if the device is already in booted state while erasing content and settings

I meant you don't need to call ClassicCommands.killall("iOS Simulator");. You can erase after xcrun simctl shutdown <uuid>.

Do you mean even after xcrun simctl shutdown <uuid> you are unable to erase?