Open Terminal and type “drutil tray eject” to eject the disc/tray, and “drutil tray close” to close the tray.

via Force Eject a Stuck CD or DVD – Mac Guides.