only open the environment once per query