Fix unlinking directories on Windows

#3157