We also had that fixed with CDs/DVDs when the OS could lock the drive and handle the eject button any way it liked.
I didn't quite like the way Linux handled this though, not allowing the disk to be ejected as long as any file descriptors were still open, which meant you had to hunt down the processes keeping them open.
But it would be extremely helpful for writable media like flash to be able to do full write-back caching and only flush the cache when the eject button is pressed, then EBADF any further reads or writes to any open file descriptors.