Bwamem now closes db handle during align and sort