Only add proxies for env stuff that exist

plus refactoring of proxy init.
Cleaning up close() work-around