It's not from your program. It's because the terminal is opened with the sole purpose of running your program, and as such when it exits, the terminal shuts down.
If you open a shell and manually run your executable, instead of this message, you'll simply get another command prompt.