Code::Blocks is an IDE, not a compiler.
If your program does not close correctly, it is most likely a problem with your code.
How to exit your program correctly, depends very much on the toolkit you use, as oBFusCATed has posted.
So with this less information, it's not possible to give you meaningful help.