Got it working!
I was using the right file "/spi/main.hex" but in the circuit I changed the type of oscillator from a ceramic to a crystal . After reading the datasheet I changed the fuses to "-U lfuse:w:0xff:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m" in avrdude and it worked. If you need a fuse calculator: http://www.engbedded.com/fusecalc
I added 22pF loading capacitors for the crystal just in case.