The enclosure cuts power to the drive when the computer goes to sleep, the enclosure's sleep timer expires, or USB is unplugged. According to Western Digital support, it sends a standby immediate command before cutting power, which is the right thing to do. The problem seems to be that the enclosure cuts power too soon after the command, without giving the drive enough time to finish unloading the heads. If the drive gets a standby immediate command while the heads are unloaded due to the 8 second idle timer, it will first load and then unload heads, and that takes some time.
An emergency retract is more violent than a normal controlled retract performed while the drive has power. Heads are retracted using power generated from the disk platters' inertia. It wears out the drive more than a normal retract.
It's surprising that this problem exists in the first place. It is a Western Digital enclosure sold with a Western Digital drive inside. Surely they should know how long they need to wait after a standby immediate command before cutting power! The worst problem though is that they're not fixing this. I opened a support request on 11/29/2015. They asked for information, contacted the external drive team and gave me some information. Then all contact stopped. After a few months I escalated the case. They asked for the same information again, and there was no contact since then.
There is a workaround in Linux. Unmount the file system,
sync, send a standby command with
hdparm -y, wait for the drive to spin down and then unplug USB. (Don't use
hdparm -Yfor sleep instead, because the enclosure runs into problems when the drive is in sleep mode.) Once the drive is already in standby, nothing happens when the enclosure sends a standby immediate command and cutting power immediately is okay. I don't know how to accomplish this in Windows though.
Because of this bug and the lack of support, I'm beginning to think that it's a bad idea to buy Western Digital external drives. Another thing to consider is that the enclosure controller board encrypts data even when no password has been set. So, you cannot simply take out the drive and access data via a different enclosure or as an internal drive. If the controller board fails you need to replace it with the same model of board, and if the drive fails you will have difficulty recovering data.