Added handling for Control-C to free gfx resurces