Clean up thread-local structure