Minor fixes for animation in test suite

Fixes for a couple of minor things I missed when adding animation to the test suite:

 * Stop the animation timer _before_ clearing the canvas
 * Only attempt to run the returned function if it's actually a function!