Those switches aren't all that good. You can try to use a spray contact cleaner to see if that helps. I'd think it's going to be the switch or a wire connection before suspecting the motor.
Maybe pull the switch out of the wall, and the next time it's acting up, use a jumper to jump the contacts and see if the lid opens.