Let me see if I get this. While you were trying to copy the file. You
were trying to delete it. Is that right? If so the OS was doing what it
was supposed to do. Deny access to the that file to the process that
wanted access to the already opened file. No matter how the error was
reported the result was the same. Your second process was denied access.
This reasoning can be compared to gparted being denied access to a
mounted partition or device. When you want to format a mounted
partition, you must first unmount it, otherwise The OS will assume the
process that has it's hooks is still using it, even if the only
connection is that the file system has opened it. Don't you love Linux?
I do.