kicking cc3k

This PR does 2 things:

* kicks out of a forever loop if we miss an IRQ
* correctly tracks sockets closing
This still has the wrapping issue? We should prioritize fixing it if we're using it internally for timeouts. Or you could check if the timeout goes negative.