Cannot upload sketch to Atmega328p TQFP soldered on PCB
It looks like the capacitors on your crystal are considerably bigger than they should be.

You are switching the clock to the external crystal, and because you have such massive capacitors on it it's failing to oscillate.  Without that oscillation the chip can't run, and so it can't respond to the programming.

The crystal capacitors should be roughly 2x the "load capacitance" of the crystal you are using.


  CX1 = CX2 = 2(CL - CSTRAY)