Allen survives scare to win Snooker World Grand Prix