This patch makes chasquid flush logs periodically, and also before exiting,
even if it gets killed via the usual signals (including Ctrl-C).
Both things help troubleshooting when there is not much traffic, or we kill
the server manually (including during automated tests).