Handle tread terminnation while capturing runtime from jvm