Flush buffer from Elementor’s image optimization feature

<?php
/**
 * flush Elementor buffers for Image Optimization feature
 **/
add_action( 'shutdown', function() {
    if ( FWP()->request->is_refresh ) {
        $buffer = ob_get_status();
        if ( 'Elementor\Modules\ImageLoadingOptimization\Module::handle_buffer_content' ==  $buffer['name'] ) {
            ob_end_flush();
        }
    }
}, -1 );