showed some love to closemeshKD and underlying FORTRAN routine matr_meshKD