So the issue was not with antivirus, IDE, terminal or file permissions. It had to do with gradle's daemon. It might have to with the fact that the deamon gradle had a lock on a file in the build directory. This might have been caused because I changed the name of some folders in my project. Below are the steps I took to fix this.
1: Delete the build folder (not sure if this is necessary but just in case I included it here)
2: run the following command in your root directory: ./gradlew --no-daemon clean
(This should clean out your build directory if you have not done the 1st step.)
3: then run the following command to build ./gradlew build --rerun-tasks -x test
--rerun-tasks make sure that no task is skipped and -x test makes sure that you skip the test task which was useful in my situation as I did not have test.
4: then you can run the following to start spring boot. ./gradlew bootRun
.
After this using the gradle daemon should work normally.