Mining bot script

Hi, im using the sanderling mining script, i have modified it so far to better suit my needs but have found the limit of my coding abilities.

if possible i was hoping to add a line that turns off the miners before going into warp (thus transferring whatever ore they have already mined (even though its not a full load))

Thanks very much any help is greatly appreciated