Takes screenshots and on error.