Ensure output is fully written