The clam shell is driven by an electric motor and cables with an encoder. The encoder is on the rear of the motor. You can check the position with an Ohm meter. If the cables are binding it will cause the encoder to bounce in and out (chatter) and cause the lid to not close. Pull carpet check fluid if low reach in on both sides to see if hydraulic pistons are leaking? Top will need to be calibrated if you reset encoder. Check out this link
https://f01.justanswer.com/porscheguru/c9fdef17-811b-426c-85cf-3b61a7447659_Converting+motor+for+convertible-top+compartment+lid+drive.pdf
Good luck