Properly clear contents of last tab after closing it, fixes #349