Close files on image create

The file opened for --file was never closed.  Close it if it is a
file object.

Change-Id: I7bd120a2413de42339771d01e8fd1894d38c3011
Merge "Close files on image create"