It might be a good idea to see how many files are open and try increasing the open file limit (this is done on an os level). In some application use-cases it is actually a legitimate need.
If that doesn't help, make sure you close any unused files and streams in your code. It will also be easier to help diagnose the issue if you send an error-reproducing snippet.