fix tests on windows 7 by closing streams