How to show progress bar is in processing and hide after completion?

function addOrderScanner(frm, scannedBarcode){
    frappe.show_progress('Processing Orders', 0, scannedBarcode.length, 'Processing...');
    frappe.call({
        method: 'frappe.client.get_list',
        args: {
            doctype: ' Vendor Order',
            filters: {
                vendor_id: frm.doc.vendor_id,
                status: 'Open',
                vendor_address: frm.doc.pickup_address_vendor,
                name: ['in', scannedBarcode]
            },
            fieldname: ['name', 'vendor_tracking_number'],
            limit_page_length: false,
        },
        callback: function(response) {
            if (response.message) {
                var orders = response.message;
                let orderFound = false; 
                let orderFoundList = [];
                let ordercount = 0;

                // Initialize progress
                let totalOrders = orders.length;
                let addedOrders = 0;

                frappe.show_progress('Processing Orders', addedOrders, totalOrders, 'Processing...');

                orders.forEach(function(order, index) {
                    if (scannedBarcode.includes(order.name) || scannedBarcode.includes(order.vendor_tracking_number)) {
                        orderFound = true;
                        let childOrderFound = false;

                        for (let i = 0; i < frm.doc.order_list_table.length; i++) {
                            if (frm.doc.order_list_table[i].order_id == order.name) {
                                orderFoundList.push(order.name);
                                childOrderFound = true;
                                ordercount++;
                                break;
                            }
                        }

                        if (!childOrderFound) {
                            var child = frm.add_child('order_list_table');
                            frappe.model.set_value(child.doctype, child.name, 'order_id', order.name);
                        }
                    }

                    // Update progress
                    addedOrders++;
                    frappe.show_progress('Processing Orders', addedOrders, totalOrders, 'Processing...');
                });

                // Hide progress and complete the task
                

                // Show success message only after progress bar ends
                if (orderFound && !frm.doc.scanner) {
                    frappe.show_progress('Processing Orders', 100, 100, 'Completed...',false);
                    frappe.msgprint(`<b>${scannedBarcode.length - ordercount}</b> orders added successfully`, 'Success');
                }

                if (orderFoundList.length > 0) {
                    frappe.msgprint(`Orders <b>${orderFoundList.join(', ')}</b> are already added`, 'Found');
                }

                if (orderFound == false && frm.doc.scanner) { 
                    
                    frappe.msgprint(`Order ID <b>${frm.doc.scanner}</b> not found`, 'Failed');
                }

                frm.refresh_field('order_list_table');
                frm.set_value('total_packages_from_table', frm.doc.order_list_table.length);
            } 
            else {
                // Ensure progress is hidden even if no orders are found
                frappe.hide_progress();

                if (frm.doc.scanner) { 
                    frappe.msgprint(`Order ID <b>${frm.doc.scanner}</b> not found`, 'Failed');
                }
            }

            frm.set_value("scanner", "");
        }
    });
}

well this not working in my caseā€¦