Fix MocoCacheTest to work on Windows
Ensure streams are closed so that files can be deleted