Don't write to output stream if any error occurs.