@Divo
You would want to adjust your script to disable the smb share or put it in maintenance mode prior to shutting down.
I ran into an issues for when I was shutting down a Remote just to save power - https://xcp-ng.org/forum/topic/12339/xo-unresponsive-when-remote-storage-is-offline.?_=1791151494204
It still didnt help with the unresponsivenes. This was with a Backup Remote not a SR but enabled maintenance mode before shutdown and disable when back online.