Fixed bug when the terminal doesnt detach on its own.