Stability, Electronic and Magnetic Properties of In-Plane Defects in Graphene: A First-Principles Study