Error when code examples are improperly closed
# What does this PR do?

When an MDX file has a code sample that is not properly closed, the doc styler ends up removing part of that file. This PR addresses that problem by raising an error before the file is overwritten, so the user knows what's wrong and can fix it.