close thread handle right after creation of the thread