close down tcp listener and exit when GUI exits