Fixed threads not exiting