safe handle has been closed in DetectOpenFiles class


I am using DetectOpenFiles class to check that file is open or not from my application. Everything works fine but it gives below error:
"ObjectDisposedException: Safe handle has been closed"
After getting this exception i am not able to end application process even in task manager by calling end Process. I have refered all the code in class but not able to identify where it uses disposed object again.
1) How to resolve this error?
2) This function works only on Xp machine. When i test this code on vista64bit, OpenFiles enumerator gives nothing value.