Programmatically opening & closing Neo4j db in python

Say I have two Neo4j databases in a project and I need to switch back and forth between them. Currently, on the desktop application, I open and close the databases manually and re-run:

driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))

Is there a way for me to circumvent having to manually open & close?

I have tried the following with a TEST_DB that I created in Neo4j desktop:

uri = "neo4j://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))
with driver.session(database="TEST_DB") as session:
    cypher = '''
    MATCH (n) -[r:CITES]-> (m)
    RETURN n, r, m
    '''
    output = session.run(cypher).data()
    print(output)

As well as:

uri = "neo4j://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))
session = driver.session(database="TEST_DB")

cypher = '''
MATCH (n) -[r:CITES]-> (m)
RETURN n, r, m
'''

result = session.run(cypher).data()
print(result)
session.close()
driver.close()

Both return an error:

ClientError: {code: Neo.ClientError.Database.DatabaseNotFound} {message: Unable to get a routing table for database 'TEST_DB' because this database does not exist}

My guess is you need to use https:// instead of neo4j:// but I could wrong.... (I'm still new at this too.)

What you see in your Neo4j Desktop with 3 dots, a start and stop big blue buttons is not a database, it's a DBMS, database(s) management system.

I would suggest you updating your Neo4j desktop app and then create a local DBMS version 4.2.2 and then read about database administration and the USE clause.