I did some testing and it appeared to work. But last night, there were two jobs running, one ended first and disconnected the storage repository connection and caused the second job to fail midway. Now I can't re-run the job because I get the error "Error: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1."
The last restore point might have become corrupted and you might need need to delete it first before proceeding further. Open a support ticket and let them confirm that. Thanks.
Chances are .State property had a different value at the time of script execution: "starting" or similar. Thus, the script proceeded further and disconnected the backup storage. Thanks.