Close files on decoding
Use jpegs if data wasn't raw