Close image file only if it is not stdin/stdout

Command "partimage imginfo stdin" would hang due to closed stdin.

Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>