Modified script to shutdown emulator