Well, this is just a minor patch.
I one day realized that a "open tray" key in Gnome is pretty worthless if it can't close the tray as well.
I of course wondered how this could be done and why it hadn't already.
As it turns out, the ioctl-call for the traystatus didn't work that great.
So me and my friend wrote this workaround that checks if it takes shorter than 1 second to open the tray, the tray should be closed instead.
Of course, some cd/dvd-players might eject quicker than that, but hey, that's what the community's for, right?
Update: This has been modified and included upstream but without credits... (eject-2.14, maybe earlier)
eject-toggle.diff