In err_cleanup(), cleanup the thread local storage too