[3.0] Clear up env when destroy (#10193)