properly separate persistent handles per thread