add method to gracefully close server
catch ctrl-c kills
update tests