Update CastleGame.cpp

stop the infinite loop when input mode close