After all the Sprite objects are destroyed python will give an error because there is no object to access.
Change the code to check if there are objects to access:
if len(Sprite) > 0:
if Sprite.Value('av')<= 995:
Sprite.SetValue('av',Sprite.Value('av')+5)[/code:pgglqjf1]