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

This 'else if' block is for the original 
int exitCode = simctlCmd.executeAndWait(true);
because I am passing 'ignoreErrors=true' it does not throw exception if there is a non-zero exit code.

The call to simctlCmd.executeAndWait(false) within the exit block will throw an exception in the case of non-zero exit code.