Fix potential deadlock in PeerTableModel

As reported in #4296.