Merge "Add thread cleanup test"