o.c.opibuilder: Attempt to account for unreliable behaviour when opening shells

Sometimes when a new shell is opened it doesn't receive the shellActivated
callback. Also raising a shell doesn't always work once it's already open.
These changes mitigate these effects to some extent.