I think maybe finally killing the server/client threads is working.
Threading is nasty. It seems the running boolean was not getting set
to false fast enough. So the loops kept running after the sockets were
closed and generated exceptions.