Properly close the rowScanner and tables