I'm making a chrome extension that read a current tab's content and does a heavy task on backend. What if I close a tab during its process? I'd like to allow a user to close tab without waiting for a process to finish. My code is like below. It is written in React and Typescript. Thank you in advance.
import React from 'react';
export const PopupPage = () => {
  const doTask = async(event: React.MouseEvent<HTMLButtonElement>) => {
    chrome.tabs?.query({
      active: true,
      currentWindow: true
    }, async tabs => {
      const currentTab = tabs[0]
      const currentUrl = currentTab.url
      const currentTitle = currentTab.title
      if (currentUrl === undefined) {
        return
      }
      const creationOptions = {
        type: 'basic' as chrome.notifications.TemplateType,
        title: `Nice title`,
        message: `Start a heavy process`,
        iconUrl: './logo.png',
        contextMessage: 'You can close the tab now.'
      } as chrome.notifications.NotificationOptions<true>;
      chrome.notifications.create(currentUrl, creationOptions)
      
      // Send a url and title to backend and wait for it finishing.
      await executeHeavyTaskAndWaitForResponseFromBackend(currentUrl, currentTitle)
      const updateOptions = 
        {
          type: 'basic' as chrome.notifications.TemplateType,
          title: 'Nice Title',
          message: "COMPLETED",
          iconUrl: './logo.png'
        }
        // I want to be sure this notification is called even after the tab is closed
        chrome.notifications.create(currentUrl, updateOptions)
    }); 
  }
  return <button onClick={doTask}>Do a heavy task</button>
}