In a huge code its some times gets difficult find out open files which have not been closed unconsciously. The linux
lsof command can be a big help on that.
lsof | grep
will show the files corresponding to the related program that has not been closed for some reason.
take a look at the lsof man page for details.