Structural, Optical, and Magnetic Properties of Gd-Doped TiO2 Nanoparticles