Fix #5207: move animating flag

Set animating flag after checking for end slides/circular
Merge pull request #5212 from hirechrismeyers/5207

Fix #5207: move animating flag