windows testing fixes: avoid perl's textmode STDOUT and be really good about closing file handles so rm can work