It is somewhat tedious to close a terminal window shell manually after the shell exit. By default Mac terminal does not close the shell on exit. Here is how a shell looks like if you exit using CTR-D.
You can change the behaviour to close shell after a clean exit. For this click on
Terminal > Preferences... > Profiles. Then select the desired profile and then select shell tab. Change the settings for “when the shell exits” to “close if shell exited cleanly” as shown below:
Now when you exit a shell using CTR-D, the shell will close automatically.