My washing machine would continue its cycle after the water filled up with the lid closed. For a while it would eventually come on after five or six minutes. After finally failing, it was a simple repair. I removed two screws to open control panel of the washing machine. I tested the lid switch to verify it was faulty. Then removed the ground screw and swapped it out. It runs fine now.
Be aware that if your lid switch stops working with a washer full of water you might need to bypass the lid switch to make the washer drain. The video on this site went through every step.