6. Let $x_{1}, x_{2}$ be the two real roots of the equation $x^{2}-2(k+1) x+\left(k^{2}+2\right)=0$, and $\left(x_{1}+1\right)\left(x_{2}+1\right)=8$. Then the value of $k$ is ( ).
(A) -3 or 1
(B) -3
(C) 1
(D) all real numbers not less than $\frac{1}{2}$
6. C. 

The above text has been translated into English, preserving the original text's line breaks and formatting. Here is the direct output of the translation result.