I have spent way too much time on this so I am reaching out for help to guys that are much smarter.

This is the most simplistic version I can make to recreate this problem. It is a wxwidgets (wxdialog/wxsmith) application but I can run it from the command line so it starts the gui and gives me cout in the console.

This code is a wxDialog and creates a 2nd thread "std::thread m_threadWebListener" but when you go to close the form it will not close.