@app.teardown_request
def teardown_request(exception):
    if hasattr(g, 'db'):
        g.db.close()
executes functions after all requests
dataset/ETHPy150Open claudyus/LXC-Web-Panel/lwp/app.py/teardown_request