How do I auto close the browser tab when the macro finishes running?

You need to install the XModules first: Download XModules for enhanced features, Robotic Process Automation (RPA)