Fix #5207: move animating flag

Set animating flag after checking for end slides/circular