Adaptive stabilization of quantum circuits executed on unstable devices