Update Issue 55

Better clean up on shutdown to avoid blocking the shutdown thread