flush log at shutdown