Windowed Integral Equation Methods for Problems of Scattering by Defects and Obstacles in Layered Media