O(3) nonlinear sigma model in 1+1 dimensions with matrix product states