[file]: Fix EBADF errors when removing files that don't exist (#37758)
On Windows, we need to add back write permissions to files that we want
to delete. When attempting to do this, if the file itself doesn't
exist, `chmod()` can throw a couple of different errors that are not
caught by our `catch` statements here. Rather than attempt to do these
useless operations, we'll instead only `chmod()` if the file itself
actually exists.