Fix RuntimeError when stopping backend multiple times