added extra precaution measure in readDataFile() - set doc to NULL after freeing.