split up the db actions into separate connections that close right after