Join threads before releasing master thread