Move signal handling into io.c

This eases the handling of stopping the daemon and should give a
slight performance boost.