application exits correctly on losing/winning