auto close file; locate error when failing to parse