Stop getting EMFILE errors by only opening as many files as the operating system supports