rpc: fix exception in finally state