Try to fix crash at exit