This should use quit-window-hook, with various local values depending on the major mode of the sbbs buffer.