Secure Erase with diskutil crashes consistently with OS High Sierra 10.13.6
I am trying to securely erase unused space on my iMac's internal hard disk under OS 10.13.6, using the Terminal. Over several attempts, some using freespace setting 0 and some 1, my computer hangs up when between 71% and 84% of the free space has been erased (see screen grab attached); this usually leads to a major crash in which either I must do a brutal restart by unplugging the power cable, or else (when left to run overnight) the computer crashes and goes to a black screen, necessitating a restart.
The reason I am using the Terminal rather than simply going through Disk Utility's Erase function is that the relevant button is greyed out. Any suggestions? I have already run Disk Utility's repair function.
iMac 27″, macOS 10.13