doing in background. releasing to safetely call on_exit