better finalization of the rpc ctx