* Fix memory leak on raw rpc call
While processing a raw rpc call an observable is removed from the wrong cache. It causes a memory leak.
* Fix memory leak on raw rpc subscription, fix types
Fixed similar memory leak on raw rpc subscription.
Also added proper type declaration for the return value of the _memomize function to address build error.