Fix memleak in RemotePromise.wait