Fix a threading issue that was causing error dialogs from freezing the program