ensuring ParsingContext.processEnded is invoked only once (when reaching the end of the input or in case of errors)