Make reinstall transaction safe.

* Aborting during reinstall will now restore the originally installed keg.
More robust exception handling.

* It is possible that install_formula of install may raise exception
  that got swallowed.  So implement another helper that reraise the
  exception and hand it over to clean up routine.