fix endless loop when there is unterminated string before end of file