Trapping of hydrogen by oxygen and nitrogen impurities in niobium, vanadium and tantalum