Because this is a common problem, there are solutions ready to buy! This page describes the exact scenario [www.orientalmotor.com] "Electromechanical brake type used for vertical operation" There are stepper motors with builtin electromechanical brake, and you can also get braking units.
Whether off the shelf or DIY, the principle is the same as Dust describes.
Whether off the shelf or DIY, the principle is the same as Dust describes.