Table position, sort, visibility and size are now saved and loaded.

Fixed a bug where tables weren't getting removed from the map when we
changed document.