Added code to write confusion matrix out to a file.