[backends/jscommon] Fix racy exit from dispose