Yeah this is a known bug. It will bug out if you switch tabs/navigate away entirely. Curiously, it seems to work if you keep it running as the active tab but use a different window for other stuff
That sounds like it behaves badly if getAnimationFrame() takes longer than expected (which happens when you tab away, the browser's slowing down javascript that "doesn't do anything" (Think news sites and such)
Would be worth looking into your code, maybe introducing some manual delays to see which codepaths are timing sensitive!