Fixed concurency race condition with thread variables. Fixed when closing the server the socket releases control of the port