Add remaining D keywords
main: Refactor quit functions

Move quit-related functions to main.c and make them static. main_quit() now
does all the heavy work and can be called from signal handlers.