Close terminal when shell stream is over