Following the Gurobi documentation: https://www.gurobi.com/documentation/9.5/refman/logfile.html#parameter:LogFile
Determines the name of the Gurobi log file. Modifying this parameter closes the current log file and opens the specified file. Use an empty string for no log file.
So I assume you just need to pass an empty string "" as the new log file name before trying to delete the former.
If that doesn’t work:
How are you calling Gurobi?
Are you creating multiple models? Or re-using an environment?