That's what safeties are for! We already have a lot of engineering around making elevators safe. TLDR the elevator will clamp on to the rails to slow the free fall.
Neat info below on snapping elevator cables and some of the things that would help you.
https://science.howstuffworks.com/science-vs-myth/everyday-m...