Quit any app that you were using with the file, then empty the Trash.
If that doesn't work, the app might have one or more background processes that are using the file. Restart your Mac, then empty the Trash.
If that doesn't work, you might have a startup item or login item that is using the file. To temporarily prevent such items from opening automatically, start up in safe mode by holding down the Shift key while your Mac starts up. Then empty the Trash and restart your Mac normally.