Allow app to be flushed during teardown.

Signed-off-by: crynobone <crynobone@gmail.com>