Hi Dushyant:
It is hard to say if there is something "wrong" in your code, and I would say that if it is running properly most of the time, the code should be good. Based upon your last post, it sounds like the error may be initiated by the device and not from the program since the device reports an error, then LabVIEW tells you that I/O was terminated. Also, it is hard for me to tell exactly what is going on without having the device and because I do not have several of the subVIs in your program.
However, here are a couple of suggestions: you may want to put your error handlers outside of the while loop. Sometimes having the error handler inside the loop causes an infinte loop of pop up error messages. If it works for your application, you may want to put the error handler outside of the while loop and program the loop to stop if an error occurs. Also, in your first post you asked if there was some way to automatically hit the ok button. There is no direct way to do this, however if all you wanted to do is ignore the error, you could use the General Error Handler (found right beside the Simple Error Handler on the Time & Dialog Palette) and set it to ignore a certain error code.
Again, my first thought is that the device is causing the error and not the program, but I hope something here can help you out.
Emilie S.
National Instruments
Applications Engineer