Why does the CD tray keep opening and closing?
It constantly closes and opens until I play a tape then it stops. Ive tried playing CDs and all it does is scratch it up
If the CD discs are literally being scratched after being inserted into the CD player, it seems that something has broken or come loose inside the player mechanism, which is scratching the CD disc and also stopping the tray from fully loading the CD.
Here's the HCD-CP1 service manual for the unit which will help you to dis-assemble it to remove the CD player and to open it and check what has happened.
I realize that you said that it is a CMT-CP1 but the HCD-CP1 is the Amplifier, CD player, Tape Deck and Tuner section in the CMT-CP1 unit.
Hopefully this is of some help.