Kill thread when it is done