[24] Better attempt to fix race condition crash on program close.