private void shutdown() {
    stopping = true;
    if (cpu != null)
        cpu.stop();
    if (screen != null) {
        screen.deleteInterruptManagers();
        screen.motorSound(false);
    }
    cpu = null;
    screen = null;
    removeKeyListener(canvas);
    canvas = null;
  }