If you can catch an underbaked cake within 5-10 minutes of taking it out of the oven, you can totally fix it. I'd recommend loosely covering the cake with aluminum foil and baking it at a slightly lower temperature (325 degrees Fahrenheit). Depending on how undercooked your cake was, I would check on it in 2-3 minute increments. After the cake has cooled for more than ten minutes, it's best to discard and start again. Such a bummer... I know!