We now wait for the thread to exit before stopping the polling thread