Do not call endwin nor exit from signal handler

This ensures that only asynchronous-safe functions are called within the
signal handler. In addition, it cleans up tig's shutdown mechanism so that
done_display (and endwin) is called via an atexit(3) handler.

Reported by Markus Elfring.
Fixes #245