JAI service: ensure that MemoryCacheImageInputStreams are closed

This prevents memory leaks when reading many JPEG-2000 tiles in
sequence.