Release locks before calling rpcRunLater.
Quick explanation: rpcRunLater leads to event_free which calls event_del which can wait for the event callback to finish if it’s already running and that callback will try to lock wallet mutex - which is already locked in http thread.
Fixes #14995 , fixes #18482. Best reviewed with whitespace changes hidden.