As has been mentioned before and since, I also had some clear plastic drywall corner guards, cut to fit length of cabinet and double-sided taped to front edge of shelf (also have much of thin stuff). Easy-peasy and very effective keeping things in enough to prevent fall-out ever.
Well…after removing the four screws I discovered that the top of the cabinet was caulked to the wall. Since I didn’t want to damage the wall using a metal scraper I heated the caulk with a hairdryer and gently rocked the cabinet up and down till it pulled off. Then getting the caulk off the cabinet and the wall was a pain in the arse. It’s remounted. Now I just need to recaulk the top.
Glad that it worked for you. The cabinet is probably ABS and easily deformed by heat. You got away with it but I'd stick to slicing the caulk in the future.
We also removed the medicine cabinet to use the wall cavity as a wire chase for solar panel views from the roof to under the D/S dinette in our E19. We suspected it was Proflex. Used rubbing alcohol and mineral spirits to complete removal of the sealant.