[rustdoc] Create output file after we checked that the standalone markdown file is valid
This PR makes the creation of the output (HTML) file after we checked that the input markdown is valid to prevent the output file content to be truncated ([`File::create` doc](https://doc.rust-lang.org/nightly/std/fs/struct.File.html#method.create)) in any case.
r? @Urgau
Furthermore, populate `tests/run-make/rustdoc/doctest/` with doctest
run-make tests and `tests/run-make/rustdoc/scrape-example/` with scrape
example run-make tests.