Close temporary stdout and stderr files in unit tests before deleting.

Fixes file-in-use error on Windows.