Fix memory leak in JPEG2000 decoding, and JPEG decoding using PyPy