Electronic and magnetic properties of nitrogen-doped graphene nanoribbons with grain boundary