Addition of the exit on the end game function