Wait in at_exit instead of simply flushing.
Default to waiting a maximum of ten seconds.