Handle send failure

We catch IOExceptions and log them to stderr instead of crashing.