removed redundant db close statements