Added missing closes to hgfs.

This should resolve #8811 and possibly #8810.
Merge pull request #8838 from shadowfax-chc/hgfs-too-many-processes

Added missing closes to hgfs.