Readded writing screenshots when tests fail.

Resolves issue #247.