limit number of file open to avoid crash on OSX