It is not working as expected because one of the duplicate is closest to a point having a different name
Instead, it is possible to get multiple nearby points - with a max distance - and to count if there are duplicated names.
max_distance restrict the search radius (in map units).
limit: how many points to consider (
-1 would have been ideal but I couldn't make it work. Use a large enough value to go over the "nearby but with a different name" points).
"name" return an array of found names.
array_filter: keep only names being the same as the current feature name (including itself!)
array_length .. >1: since the current feature name is returned, look for duplicates (or more)