Let $N_{H=4}$ be the number of trials until we count four heads and $N_{T=9}$ that until we count nine tails.
We want to find: $E~=~\mathsf E(\min \{N_{H=4}, N_{T=9}\})$
Now, this is just the sum of Heads and Tails under condition that we have either four heads and less than nine tails, or nine tails and at most four heads. (Thus including the case where we have both four heads and nine tails).
Letting $H$ count heads and $T$ count tails then:....
$$E ~=~ \mathsf E(H{+}T\mid (H{=}4\cap T{<}9)\cup (T{=}9\cap H{\leq}4))$$
Now, since for disjoint events† $A,B$, and random variable $X$, we can show (can you?): $$\mathsf E(X\mid {A\cup B}) ~=~ \dfrac{\mathsf E(X\mid A)~\mathsf P(A)+\mathsf E(X\mid B)~\mathsf P(B)}{\mathsf P(A\cup B)}$$
(† that is, disjoint, non-zero probability-measure events, to be proper.)
Then...
$$E ~=~ \dfrac{\mathsf E(H{+}T\mid H{=}4,T{<}9)~\mathsf P(H{=}4, T{<}9)+\mathsf E(H{+}T\mid H{\leq}4, T{=}9)~\mathsf P(H{\leq}4, T{=}9)}{\mathsf P(H{=}4, T{<}9)+\mathsf P(T{=}9, H{\leq 4})}$$
Okay, so because we know that $\mathsf P(H{=}h \cap T{=}t) ~=~ \dbinom{h+t}{h}~2^{-(h+t)}$ , then: ...
$$E ~=~ \dfrac{\sum\limits_{t=0}^8\dfrac{4+t}{2^{4+t}}\dbinom{4+t}{4}+\sum\limits_{h=0}^4\dfrac{9+h}{2^{9+h}}\dbinom{9+h}{9}}{\sum\limits_{t=0}^8\dfrac{1}{2^{4+t}}\dbinom{4+t}{4}+\sum\limits_{h=0}^4\dfrac{1}{2^{9+h}}\dbinom{9+h}{9}}$$
Simplify and evaluate.
PS Hint: A short cut to evaluating those series may be obtained by observing that we are dealing with two negative binomials cases: the count of trials until 4 heads before 9 tails, and the count of trials until 9 tails before 4 heads.