Use window.cancelAnimationFrame correctly