Maximal prefix codes and maximal length
I'll assume that a prefix code is a set of words in which no word is the prefix of any other, and &quot;maximal&quot; means it is impossible to add any word to the set and keep this property.
Let $w$ be a maximal-length word that is not in $X$. There are two possibilities:

At least one (shorter) word in $X \setminus F$ is a prefix of $w$, in which case we could not add $w$ even if we first remove all words in $F$ from $X$;
No (shorter) word in $X \setminus F$ is a prefix of $w$, in which case we could add $w$ to $X$ without needing to first remove any words in $F$, contradicting the assumption that $X$ is maximal.