An adaptive finite element method for nonlinear optimal control problems