Dep/ACE: Fix assertion triggered on shutdown

Fix assertion triggered on shutdown on Windows platform Debug mode by back-porting fix from ACE revision 96226.
Fixes #9770.