My husband’s nightstand was sliding open for whatever reason and would never ever stay closed. It was driving us nuts until one day I grabbed some crazy glue and magnets and solved the problem in a matter of seconds. The drawer stays shut now, but since the magnets aren’t super thin, the closed drawer juts out a tiny bit when it’s closed (as you can see in the last pic), but it’s much better than before.
In order to get the two magnets to line up perfectly, I just kept the two of them stuck together and glued one side to the drawer and waited for it to dry. Then I put a blob of glue on the back of other magnet, closed the drawer and waited for it to dry. Voila! Now open your drawer and close it and open it again and close it again because you just solved an annoying problem and are feeling invincible. Your drawers will now stay shut, hiding all those private and embarrassing things one usually keeps in their nightstand.