Many Linux users already know about the eject command for opening the disk tray:
How do you close the tray?
Turns out that you can use the same eject command but with an additional -t option to close the tray.
$ eject -t
Before I found out about the -t option, I always had to reach and press the open/close button on the drive to close the tray. With the -t option, you can now both open and close the tray from the command line.
There is another option -T (CAPITAL T, that is) you should know.
eject -T basically closes the tray if it is open, and opens the tray if it is closed.
The man page for eject has detailed explanation about the options.