Great script! Worked like a charm for me when I wanted to remove a disk to reformat it.
But I was wondering if it would be possible to write the same marker as preclearing a disk does at the end of the script? Because after I removed the disk I still had to preclear it (basically a second time) -- which was a total waste of X extra hours 😬