fixed app crash while closing last tab