The sensor that senses opening and closing is probably bad in the sunroof.

Welcome to GPF.