Residual finiteness of a class of knot groups