Added an if statement around failure image generation

This makes certain we don't accidentally overwrite the original image with the failure image when the filename doesn't match XXX.diff.png