Analysis and mitigation of interface losses in trenched superconducting coplanar waveguide resonators