close fds properly
Fixes proxy support