proper cleanup
this should ensure that all process registrations etc have disappeared
by the time we return from the function.