Put environment termination to separate handler