UK narrowly avoids recession after figures show growth stagnating