As M&A failure soars, here’s how to walk away from a deal unscathed