Mac keeps SMB files/session open, locking files
Closing the Finder window is not enough to stop the SMB session. You need to eject the SMB share in the same way you eject external drives or a CD/DVD, that is, select the SMB share icon on the desktop and press ⌘E.

Alternatively, you can right-click the SMB share icon and select Eject :



or, in a Finder window, press the eject button next to the server name: