[Clang] Fix assertion failure in SDiagsWriter when finish() is not called (#181712)
When `--serialize-diagnostics` is used, `SDiagsWriter` enters bitstream
blocks during its initialization. They are expected to be exited in the
`finish()` method.
However in LibTooling based tools (like `clang-tidy` or `clang-check`),
if a user provides an invalid command-line argument, the driver detects
the error and prepares for an early exit. The exit path leads directly
to destruction, skipping the call to `finish()` that would normally
occur in the main logic. Then the assertion detects this block imbalance
and triggers a crash.
As of AI Usage: Gemini 3 was used to rephrase part of the PR description
Closes https://github.com/llvm/llvm-project/issues/140433