Perfectly matched layers for the truncation of finite-element meshes in layered half-space geometries and applications to electromagnetic scattering by buried objects