Raise errors on format strings with unmatched `}`

Otherwise extra stuff after a lone '}' character is simply ignored, which is
very bad.

Closes #8938