Mg doping of GaN grown by plasma-assisted molecular beam epitaxy under nitrogen-rich conditions