You encounter this error when BOINC has too many files open at the same time, because it is not closing files when it is done with them. Always use close() on objects you opened.