resetting terminal correctly when done