Make the config parser thread-safe

fixes #7822
Make the config lexer return an error for unterminated string literals

fixes #7808