Try using CloseSTDLIB() in your destructor.This is what the SDK says:
Code:
Location: libc\sys\reent.h
Link against: estlib.lib
void CloseSTDLIB();
Description
Frees the thread-local storage acquired by the STDLIB DLL.
Data allocated in the thread-local storage for
STDLIB's DLL (the _reent structure) is not automatically cleaned up
when the environment is destroyed, and must be cleaned up
by the user of STDLIB. Call this function after the point at which
it is known that code in STDLIB's DLL will no longer be called and its
thread-local storage no longer needed.