pymongo MongoClient Takes Forever To Close

I am running an Apache server that can execute python files. To get the data from the python file it has to finish executing.

These 3 lines of code take 600 milliseconds! Absolutely unacceptable for webpages

The thing is it prints the data I need almost instantly.. And then takes 600 milliseconds to close (That was with more than these 3 lines of code obviously)

I ran it with "time python3" outside of Apache to get the time

from pymongo import MongoClient
Client = MongoClient()

Not sure if theres some code I can use to forcefully close the connection and use whats already been printed so the script can continue. Any tricks / hacky things you can think of are welcome lol