Errors in trapped-ion quantum gates due to spontaneous photon scattering