Fix handle leak if thread TLS initialization fails