There are a number of factors contributing to the execution of a script.
You browser (as a HTTP client) sends a HTTP Request of some sort; the server receives the request, looks for the requested file (nothing than a file can ever be requested on the world), and starts executing it. That's it!
Your browser does nothing regarding the management of the execution of the script, it just needs a response of some sort.
Execution would be active regardless of the connection of the server with the client.
Step 1: Your browser sends a HTTP request to the server requesting the execution of a file.
Step 2:The server starts the task of execution. If your script sends back a request within a proper time, the browser receives it, else, the browser throws time-out error/message.
Step 3: The server finishes the execution of the script. If there are any output resulting from the execution that must be send back to the browser, the response reaches the destination only if there is a live connection.
Note: Such performance-heavy, time-consuming tasks must be handled, managed and organized in a much more different and efficient way.