add closing when terminal finished