fix potential crash at session close (when port-matrix is visible)