general client cleanup / refactor thread-safe clock updater thread stopping fix double free on client exit