Built error checking into file reading/writing routines and calls of them.