In Willard's General Topology, p66, section 9.14,
the author is trying to prove that $q(Y)$ is closed in $X +_{f} Y$.
$q$ is defined as the decomposition map of $X+Y$ onto $X +_{f} Y$ where f is a continuous function $f: A\subset X \rightarrow Y$.
$X +_{f} Y$ is the attaching of $X$ to $Y$ by $f$.
In the proof the author is stating:
Let $F$ be a closed subset of $Y$. Then $F$ is a closed subset of $X + Y$ and $F = q^{-1}[q(F)]$.
However, I don't see how this can hold. Is he confusing $q$ and $q|Y$ here? But even so I don't see the path.
First of all Willard is trying to prove that $q|Y$ is a closed map, not that $q(Y)$ is a closed subset. The claim that $q|Y$ is closed is a lot stronger.
Yes, Willard meant $q|Y$ here. This isn't true for $q$.
Denote $q':=q|Y$. The equality $F=q'^{-1}[q'(F)]$ follows because $q'$ is injective (see here). And it is injective because no two distinct points in $Y$ are related, as you can verify by careful analysis of $X+_f Y$ construction.
Side note: $X+_f Y$ is more often denoted by $X\cup_f Y$ and called the adjunction space.