[UpdateTestChecks] Fix Windows error when piping outputs (#237636)
On Windows, `update_cc_test_checks` fails to update tests that pipe
outputs since opening an already open `NamedTemporaryFile` errors when
it's set to automatically delete. This PR fixes this by closing the file
after initially writing to it and then manually removing it.