I did this repair just last week with my Bosch.
At the back of the large middle rack I would have to slide a part upwards to match up with the connector in the back inside of the dishwasher each time we ran the dishwasher. Otherwise it would not close.
For my Bosch model SHP65TL5UC/02 I bought part number 0603 for $~30 from Amazon and it was so easy to replace, a 6 year old could have done it. The 2 0603s looked and acted identical, so I don't know why one was broken, but the switch fixed it.
Here is the one I purchased through Amazon :
https://www.amazon.com/dp/B082H65BJR/ref=cm_sw_r_cp_taa_gMj4EbHH3YCX7