Well, I'm not working with projects, I'm a highschool programming contestant in informatics and I usually only open one .cpp file at a time because a project for each problem solved would be an overkill... in that scenario there is no way to stop code::blocks from closing...
Uuhm, as I think it's not a big problem, it's just annoying to click on X incidentally and to have to reload all your open files... nevermind... it'd be best if you did it an option to always ask if sure to close the program..