Ok I have solved it my self
I can not believe how simple this was
If any one ever wants to do some thing similar this is how I got around it
Digging deep into the internet there are many many people with the same issue where asking a remote Linux machine via ssh to do a timed shut down results in an error and there does not seem to a fix for this. So instead of doing a timed shutdown I had to use the shutdown now command but this would make the script hang because it was waiting for a response from a shutdown system so all I had to do was change
ssh -t root@000.000.000.000 'sudo shutdown now'
to;
ssh -t root@000.000.000.000 'sudo shutdown now' &
when I found this out I was like WHAT..... THE..... FUCK..... a god dam $ sign that is all that stood in my way. For those who did not know like me this $ sign at the end of the command tells the shell run it in the background and carry on regardless if you get a response or not.