Fixerrors

This is a cleanup for the "probe" function as well as bugfixes for a few 'race conditions' with the 'close' event.