When it overfills how do you stop the water from coming into the tub? Do you turn your water supply valves to the machine off?
Try this: when it overfills unplug the washer from the wall outlet, if the water still does not stop flowing into the tub with the machine unplugged that means your water inlet valve is the culprit.
Here's the water inlet valve for your model:
Water Inlet Valve W11210463
Jake