Energy migration governs upconversion losses in Er3+-doped integrated amplifiers