Cleanup output under error conditions

Feedback from dsymonds review.