Elimination of AlGaN epilayer cracking by spatially patterned AlN mask