Effect of spin-orbit interaction on the excitonic effects in single-layer, double-layer, and bulk MoS2