close test file before removing it (otherwise might break on windows)