Attempting to fix the threading issue that is causing exiting to take a while.