Fix removing directories referred to with trailing slashes that are symbolic links

#3144