Handle c-D to quit loop.