Since connectedness components are always both open and close sets, you need an example in which "connected" is not the same as "path connected". Let A be the line segment, in $R^2$, from (-1, 0) to (0,0) inclusive (so it is a closed set). Let B be the graph of y= sin(1/x) for $0< x\le 1$. Let the topological space, X, be $A\cup B$. A and B are "path components" of X but B is neither open nor closed.