Extension Lemma for Smooth maps (Lee vs. Lee)

I've been reading Jeffrey Lee's, Manifolds and Differential Geometry and John Lee's, Introduction to smooth manifolds.

In the first book (here, in page 31), after introducing partition of unity, there's an exercise that says:

Exercise 1.74. Show that if a function is smooth on an arbitrary set $S\subset M$ as defined earlier, then it has a smooth extension to an open set that contains $S$.

Where he says "as defined earlier", I assumed he meant that $M$ was paracompact, but maybe I missed something else.

On the sencond book (check here, in page 45) there's the Extension Lemma for Smooth Functions, and it says:

Lemma 2.26 (Extension Lemma for Smooth functions). Suppose $M$ is a smooth manifold with or without boundary, $A \subset M$ is a closed subset, and $f:A\to\Bbb R^k$ is a smooth function. For any open subset $U$ containing $A$, there exists a smooth function $\hat f:M\to\Bbb R^k$ such that $\hat f|_A=f$ and $supp(f) \subset U$.

And after proving the lemma there is this exercise that made me very confused.

Exercise 2.27. Give a counterexample to show that the conclusion of the extension lemma can be false if A is not closed.

Doesn't exercise 2.27 imply that exercise 1.74 is incorrect? Are those trick questions? Like when you are asked to prove something right but it turns out is not? Or, more likely, did I missed something in Jeffrey Lee's book?

There is no contradiction. The first exercise asks you to show that there exists (at least one) open set containing $A$ on which a smooth extension is defined. On the other hand, Lemma 2.26 is that for any open set $U\supseteq A$, a smooth extension exists. This is a much stronger statement, and hence requires a stronger assumption (that $A$ is closed).
So a counterexample for Exercise 2.27 will provide one open set $U\supseteq A$ on which no extension exists. But that does not rule out the possibility that there exists another open set $\tilde{U}\supseteq A$ for which Jeffrey Lee's Exercise hold.