check that PIL can save JPEG to BytesIO

as far as I can tell, this is a bug in PIL that is fixed in Pillow.

addresses one of the test failures in #5264