fix out-of-fd issue on OSX

Sometimes app are loading large number of resources in a short period
of time. This will hit the limit of fd on Mac (256)