fixed errors
added options when closing the last tab