Bugfix: calculate end of table while still holding lock
Preserve biggest_file_id across close & re-open