Move quit handling into simple command handler.