Fix shell when closing