Deallocates the matrix datastructure, nullifies all corresponding pointers and deallocates the various nodes in the rows.