Object reference not set to instance of object

I see this error using command line automation, but have been able to reproduce in the GUI also. The scenario is that under command line automation, I get an exit code 999, when a comparison between two csv file is done. A dcp file is used to compare the files. Now, in the GUI version I am able to get the same ,by opening the dcp file, closing, opening repeatedly and intermittently I get an error “Object reference not set to instance of object”. It seems that something is caused the files to not properly load when the dcp file loads, but this happens somewhat randomly.