Add flushing on exit signal
Begin replication works