Catch SIGINT and SIGTERM, shutdown connections and exit

Signed-off-by: David Scott <dave.scott@eu.citrix.com>