If there is an interrupt, you should leave the loop.

It is probably worth having a separate finishing loop with poll