Your program should close(ie. disappear from task manager) immediately(or near enough) when you close the last window. If it is not doing this, then there is something wrong with your code.