keep port-matrix in sync when deleting ports. and fix segfault on session close with io-matrix visible