How to close DB connection in provider for commands?

Hello,

I need some values in view from DB, so I registered provider, which on boot load values from DB and create global with result. I can render views in cmds too, because there are generating PDFs, so need to be called in CMDs too.

My problem is that after this every command (e.g. adonis route:list) never end, because DB connection is not closed

So i tried

hooks.after.aceCommand(async () => {
    const Database = use('Database');
    await Database.close();
});

This hook is never called… So my question is how to close connection created with provider. Or is there some another (better) approach to add view global?

THX