Exit cleanly

Uses Ctrl-D. Had to learn a bit about ncurses since a spare call to `refresh()` before I exited was causing this kind of error: http://stackoverflow.com/questions/19724736/c-how-to-return-screen-to-normal-after-curses-program-ends

But it is all fixed now and works great!