#5492: Avoid traceback when exiting IDLE caused by a race condition.
#18196: Avoid displaying spurious SystemExit tracebacks.
Add tests for issue #18183.