added a ctrl-c handler that stops the server cleanly