Fix regrtest rerun: reset worker_bug (#162293)

When a test fails with "worker bug" and tests are rerun in verbose
mode, reset worker_bug so that tests are marked as success if the
failed test doesn't fail again when rerun in verbose mode.

TestResult.write_json_into(file) now calls also file.flush().
2 files changed