Just to be clear, while in Recovery Drive > Disk Utility, you can't unmount the internal Macintosh HD to erase the drive.
In Recovery > Disk Utility, unmount all external drives.
In the Terminal type
diskutil list
This will get a list of your drive.
The output will look something like this:
Dianes-iMac:~ diane$ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *121.3 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_APFS Container disk2 121.1 GB disk0s2
Using the info for your drive, use this command to unmount.
diskutil unmount /dev/disk0
If the drive still fails to unmount, it's possible that the drive is failing. Often Spotlight cannot let go of a failing drive. Not sure if disabling Spotlight while in Recovery will help, but it's worth a shot.
sudo mdutil -a -i off
If this fails, I would attach an external drive that is formatted as GUID. Select to install macOS to the external drive. You will boot from the external drive in a new High Sierra install. It will be formatted as HFS+ since it's a rotational external drive. While you are booted from the external you can try erasing the Internal drive. You might find this will give you more options than while booted from recovery.