Handle cases where logstash dies while decoding email headers.

This was originally from elasticsearch/logstash#1339.