Defect structure of ion-plated titanium nitride coatings