It is possible to run a set of node commands when a port disconnects. This only works with ports that need an ATTACH before use (ie not KISS ports).
The configuration command format is something like this, and goes after the CONFIG command in a PORT config section of bpq32.cfg. It is a single line, with individual commands separated by the '|' character.
DisconnectScript RADIO 11 14.102 USB|uz7ho 11 modem AFSK AX.25 1200bd|uz7ho 11 freq 2000
Note the script runs after the port has detached so you can only use Node commands, not modem commands. This is most likely to be used with RADIO commands to set the radio back to a default frequency and mode, but could also be used to change the configration of modems that can be configred by Node commands. (eg QtSoundModem).