Create snapshot only after errors

Change-Id: I893ecabaa5ca6076a7afb171d3728edee7cfbe2a
Related-Bug: #1323147
Merge "Create snapshot only after errors" into stable/5.0