safer set disposal
add Disposable class

This utility class invokes a function when disposed.
update emitter to use a disposable function

This removes the need for the custom connection class