Change from using separate fields to define stat states to flags.

We used to use stat_all, stat_fast and stat_clear. Now use flags.
Add new statistics_log=(on_close=bool) option.

That logs a set of statistics on WT_CONNECTION::close.
Fix build warning and comment in header file.
Fix build warnings about unused variables.
More build warnings:

../src/conn/conn_stat.c:478:5: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized]

(It's wouldn't be, but better safe than sorry).

and
../src/include/buf.i:44:17: error: 'path.mem' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Fix logic in statistics cursor open.

Was always copying the connection settings, rather than prioritising
the cursor specific setting.
Be consistent: setting statistics all always implies fast as well.
Update on_close statistics log to run before log structure is cleaned up.

Also add a Python test case.
whitespace
addd in flags in named order.
__wt_statlog_log_one doesn't need a local FILE handle, just pass NULL
to __statlog_log_one.

return an error value on error from __wt_statlog_log_one

whitespace
Revert "__wt_statlog_log_one doesn't need a local FILE handle, just pass NULL"

This reverts commit e02006fc7a0e083b0d102ca25a5b9339b6c56ff6.
Don't repeat the connection close in start_run() if execute_populate()
already closed it.
whitespace, return the error value from __wt_statlog_log_one() on error.
If the configuration is incorrect for WT_CONNECTION.close, note the
error but keep going, WT_CONNECTION.close isn't going to be retried.
Commit d1b8892 lost the mapping of WT_NOTFOUND to ENOENT, add it back
in explicitly.
Fix FILE handle leak, push FILE handle work down into __statlog_log_one().

While we're at it, close the log FILE handle when we're done, and check
all log FILE handle close calls for errors.
There isn't a old-path/new-path buffer pair: there's an old-path
buffer and a temporary buffer used for the new path and the time
stamp, it's confusing to call the latter "path".
Move connection close/reopen to its own function called by start_run.
Merge branch 'close-stats-keith' of github.com:wiredtiger/wiredtiger into close-stats-keith