deal with stale db connection and dplyr/plyr issue for multiple aggregate tables in same run