hxcfe.c : only dump out a new image on close

set a flag in the write function and use this to select to dump out
image on close.

Signed-off-by: Graeme Gregory <graeme@xora.org.uk>