Installd: Refactor dexopt to scoped file descriptor

Refactor the goto-fail cleanup to a unique_fd-like wrapper that
includes a potential cleanup step. In preparation for changes for
A/B OTA.

Bug: 25612095
Change-Id: If6cca85c12e0951bc468cb4f212b2f2d288c6041
(cherry picked from commit afa58d175cc3e9adaa4f8df9bc7a8fac5798a50a)
1 file changed