Fixed problem with opening too many files.