Don't use signal-unsafe longjmp in signal handler

This uses the method suggested by Leandro in
https://github.com/lpereira/lwan/issues/58 to close the main socket in
the signal handler and check for EBADF to break out of the main loop.

Fixes #58
Maybe initialize this to `-1`, so that `assert(main_socket != -1)` can be added to `lwan_main_loop()`?