Many years ago, I worked for a software company that included code escrow for our customers. If something happened to is, they could unlock the code and support it themselves.
It can be done, but probably only is in industries with strong companies for customers