fix out-of-fd on Mac

Sometimes app are loading large number of resources in a short period
of time. This will hit the limit of fd on Mac (256)
Merge pull request #698 from GnorTech/master

fix out-of-fd issue on OSX