change umask back to 022 after dup2 and close calls

This prevents root-owned mode 666 .pyc files being created

Before:
bash# find -perm -666 -ls
1459179    4 -rw-rw-rw-   1 root     root          370 Jun 16 17:21 ./collectors/etc/fifo_bridge_conf.pyc
1459100    4 -rw-rw-rw-   1 root     root          128 Jun 16 17:21 ./collectors/etc/__init__.pyc
1459101    4 -rw-rw-rw-   1 root     root          243 Jun 16 17:21 ./collectors/etc/udp_bridge_conf.pyc
1589182    4 -rw-rw-rw-   1 root     root         1537 Jun 16 17:21 ./collectors/lib/utils.pyc
1589181    4 -rw-rw-rw-   1 root     root          128 Jun 16 17:21 ./collectors/lib/__init__.pyc
1459180    4 -rw-rw-rw-   1 root     root          124 Jun 16 17:21 ./collectors/__init__.pyc

After:
bash# find  -name \*.pyc -ls
1523566    4 -rw-r--r--   1 root     root          370 Jun 24 11:56 ./collectors/etc/fifo_bridge_conf.pyc
1523564    4 -rw-r--r--   1 root     root          128 Jun 24 11:56 ./collectors/etc/__init__.pyc
1523565    4 -rw-r--r--   1 root     root          243 Jun 24 11:56 ./collectors/etc/udp_bridge_conf.pyc
1556588    4 -rw-r--r--   1 root     root         1537 Jun 24 11:56 ./collectors/lib/utils.pyc
1556069    4 -rw-r--r--   1 root     root          128 Jun 24 11:56 ./collectors/lib/__init__.pyc
1523567    4 -rw-r--r--   1 root     root          124 Jun 24 11:56 ./collectors/__init__.pyc

This also affects the mode of the pid file and log file.