Make sure parser will end if the document ends