Well done on another game!
I think I see what's causing the problem. On lines 34 to 37 you have some createSprite() and loadImage() functions which are inside the main loop. Creating or loading something inside a loop will eat up memory each frame and cause an error eventually, so I would just move those to be above the main loop. (I'd also move the next few lines, setSpriteImage/Scale, with them to keep it all together neatly.)