ensure preserve_backend_stack() preserves backend name

The backend name was incorrectly being modified outside of the with clause
when using preserve_backend_stack().