added flushing to run_mergewrites