Stability of solutions to obstacle problems with generalized Orlicz growth