Close DB connections properly in candlestorage.js