Fixed race condition where sometimes the dialogue wouldn't disappear