relay: cleanup code for parting/quitting