Thermal annealing of InN layers grown by metal organic vapor phase epitaxy (MOVPE) is investigated in nitrogen atmosphere for temperatures ranging from 400 to 550 degrees C and for heat treatment times up to 12 h. This treatment results in hydrogen outdiffusion, lowering significantly the residual n-type background doping. This mechanism is shown to be reversible through thermal annealing under ammonia atmosphere, responsible of hydrogen incorporation during growth. These results establish a MOVPE process allowing the obtention of InN samples, which exhibit similar electrical properties than molecular beam epitaxy grown samples: a key issue in view of future industrial production of InN based devices.