Save the work before any failure happen.