Palladium-catalyzed cyclization of drug candidates