Adds DB connections closing to avoid random 500 errors