Stability and Generalization for Minibatch SGD and Local SGD