Lock Levers

There are 3 levers, which are only usable when the door is closed. Aka, I need to stop the player from flicking levers if a certain codition is met. I can /replace all levers to powered=false, but thats a problem when the lever is on (it should stay on) Is there a way to lock levers in their current positions?
Continue to help post