Fix the creation of ZPOOL_HIST_CMD pool history entries.

Move the libzfs_fini() after the zpool_log_history() call
so the ZPOOL_HIST_CMD entry can get written.

Fixes #1998.