catch ctrl-c and do cleanup