Before you want to write the log file to the database, you can disable the SmartInspect object (Si.Enabled = false) and all pending messages will be written to the log file. After Si.Enabled has returned, the log file has been closed and can safely be written to the database and deleted afterwards.
Alternatively to writing the entire log to the database and using the intermediate log file, you could also write a small custom protocol for writing the log entries directly to the database. We have an article in our article section which explains how to do this and a custom protocol implementation for Sqlite as a concrete example:
By the way, the async option is mainly intended to be used with the TCP protocol and less useful with log files. Enabling asynchronous logging introduces a certain overhead and log files are so fast that enabling the option may even hurt the logging performance a bit.