Remove environment ref if the environment is removed

Deployment of review apps create a new environment, but these can be stopped. In which case we should remove the keep around ref.