Implements onerror for JpegStreams

Partly addresses #2812. It resolves the infinite loop and renders everything but the images.