Fix image files being left open and made id a local variable