Fix checkout tests on Windows

Forgot that newly checked out files on Windows will have been created with CR characters. :grimacing: 

Also, improved cleanup code to actually remove the created target directory from checkout even if another part of the test fails.