tsan: add OnFinalize() callback for frontends