python: Kill emulator gracefully