1. If the drive stays closed for a while and later opens up by itself (in Windows) try the following. Go to the device manager, find the CD/DVD drive and uninstall it. Reboot the laptop and let it reinstall the drive.
2. If it doesn't help, probably this is mechanical damage. You'll have to replace the drive. You can find drive part number and replacement instructions in the [http://www.laptopmanualshub.com/|official HP service manual].
Here's another guide explaining [http://www.insidemylaptop.com/remove-hard-drive-memory-wireless-card-keyboard-hp-pavilion-dv9000/|how to disassemble HP Pavilion dv9000 notebook].