Added missing closes to hgfs.

This should resolve #8811 and possibly #8810.