Wait for MAME to shut down correctly before terminating