On Windows renameTo will fail unless file is closed.