Here is a patch to add an exit delay to Openssh for use in tunneling; it allows you to say:
ssh -n -S 30 -L 110:popserver:110 popserver exit &
or
ssh -N -S 30 -L 110:popserver:110 popserver &
This will wait 30 seconds for the last TCP session on port 110 to close, before exiting the ssh tunneling session. More information is contained in the patch header.