Save the matrix to a file