Is there a way to close the iOS Simulator from the command line?
Try this:
osascript -e 'tell app "iOS Simulator" to quit'
killall "iOS Simulator"
in the Terminal will close it.
Also, you can launch it with iphonesim to have more control over it, including modifying the source to your needs.
For Xcode 7+ the command is killall Simulator
.