How how your ssh command need to complete? You can't run long running commands in shutdown.sh. Also there is a problem with network which can also be shutdown in the middle of your command.
Proper way is using new service for shutdown. I made this sometime back and should be on forum. But can't find it right now.
Update: found it.
shutdown.sh is executed after network is down
External Content
pastebin.com
Content embedded from external sources will not be displayed without your consent.
Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.