[Core] Fix leak caused by unreleased thread data slot