This can be caused by open file/folder handles in other process specifically within the .next folder.
For me, this was just another terminal that whose active directory was within the .next folder. Closing that terminal allowed the build to continue.