Fix a race condition in btrace.  Flush the log file before closing it.

 * This same exact race condition existed in the exec-interposing version
   of btrace, but I reintroduced it during the rewrite.