[PATCH 23/26] rpc: fix shutdown sequence when preserving state