Create tab when opening a database, delete when closing