Copy and delete was failing on Windows; using rename again (although this will not work for moving files across file systems.