WASHINGTON — The Pentagon expects Iraq to agree in writing to legal protections for the military advisory teams that President Barack Obama is sending as part of an effort to stiffen Iraqi defenses against insurgents, a spokesman said Friday.