title: How can I exit/close the Android Emulator from within a Script
body: <p>I've made a bash script that runs on an VM using Ubuntu that starts like this: </p>
  
  <pre><code>nohup emulator @2.1 -snapshot 1 -no-snapshot-save &amp; 
  echo ----------- Waiting for Device
  adb wait-for-device
  </code></pre>
  
  <p>I then do some stuff and want to close/exit the emulator abandoning the changed state after the script is done. My problem is, that I don't know how to exit the emulator - clean. 
  I thought about grabbing the emulators process ID and kill -9 it, but is there a 'nicer' way?</p>