Fix failing test_model_dump due to empty file (#84744)
The `torch.jit.save` call on a file object may not actually write the data to disk due to buffering. The call to `model_dump.main` on that file will when fail with an error like
> zipfile.BadZipFile: File is not a zip file
Inspecting the file confirms that it is either empty (usually) or incomplete (possible).
Fix this by flushing the file after saving the model.
Fixes #84745
Pull Request resolved: https://github.com/pytorch/pytorch/pull/84744
Approved by: https://github.com/kit1980