closed file on error