Macroscopic and microscopic defects and nonlinear optical properties of KH2PO4 crystals with embedded TiO2 nanoparticles