I had this issue when I tried to delete a file, but it resulted in an Apache segmentation fault. I fixed this bug and tried to delete the file again but this time it was locked.
So I think the issue is that Nextcloud locks the file before trying delete it and then, if there’s a crash or other error, the lock is never released.
I think the UI should make it clearer what file is locked and provide some way to unlock it. Or, better, have some mechanism to prevent files from being locked and never unlocked afterwards.