The president’s attendance prompted police to form a multi-block security barrier around the stadium in midtown Manhattan.