Reintroduce __main__. It's handy for testing.
Invoke quit in tests.