Prevent threading from GC before proper close. fix #3420