Small cleanup for thread stopping