Cycle not finishing

My JenAir dishwasher will go through the cycles until 32 minutes are left. Then, it stops and sounds like it is trying to go to the next cycle, but it doesn’t. When I open the door, the water is still in the bottom of the dishwasher. Sometimes, when I push the "drain" button on the front of the dishwasher, the dishwasher will drain and then go to the next cycle. Sometimes, when I just open and close the door several times, it will go to the next cycle. The heating cycle finishes the dishes. What might be the problem?