added a thread to stop the server if it is on too long