close fd's in threads