Make threaded renderer more stable to shutdown