The conclusion is also true for $k+2>n$, but for different reasons. If $k\ge n$, then Hurewicz implies $X$ is contractible, so the claim is trivial.
If $k=n-1$, assume $n\ge 2$ (the case $n=1$ is again just collapsing a maximal spanning tree). Then, there is a map $\bigvee_{i\in I}S_i^n\rightarrow X$ inducing an isomorphism on $H_n$ (since the Hurewicz map is an iso in degree $n$ for both spaces) and both spaces have vanishing homology in all other degrees by assumption and are simply connected, so this is a homotopy equivalence by Whitehead.