Only flush completed data

Addresses #3685