fix shutdown/closeevent cleaning up on wrong thread