append to file if exists (rather than overwrite), code to help recovery if fail