Gradle locks file after macOS update

Every time I do a gw clean build, it shows me lock file errors.
In order to make it work I have to delete all the lock files explicitly and then build the project.
Frustrated by this, can someone help ?

It sounds like there is another Gradle process that is running or is hung that is creating those lock files. Have you tried killing all Gradle processes? Also try stopping the daemon ./gradle stop.

Yeah tried that.
Ideally if that was the case this should not happen after restarting, right ?
So this usually doesn’t happen after first time I do it after restarting (probably since no daemons are running), but post that it happens. I can stop all the daemons manually, but isn’t that an extra step if every gradle task is finishing normally (I am anyway trying to reduce this manual step since I am deleting all lock files to make this work).
So I am basically looking for the same functionality which was before I upgraded, that is the locks were released when the gradle task was finished.