IAP uses a small memory area in SRAM, if you have interrupts this area might be overwritten (depending on you memory layout). This could explain the crash.
From the User Manual:
19.4.8 RAM used by ISP command handler
ISP commands use on-chip RAM from 0x1000 017C to 0x1000 025B. The user could use
this area, but the contents may be lost upon reset. Flash programming commands use the
top 32 bytes of on-chip RAM. The stack is located at (RAM top − 32). The maximum stack
usage is 256 bytes and it grows downwards.
19.4.9 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack
usage in the user allocated stack space is 128 bytes and it grows downwards.
Regards,
Bernhard.