fixed closing threds