To fix that you find where the code forgot to close a file, release memory etc. Very common problem.
Bob