Since we only need to take locks on folders, if the last component in the path is a file, we don't need to lock it at all.