he did not at all like the look of the cavern-mouth and he only made up his mind not to desert his friends just in time to scuttle over at the heels of the fast elves , before the great gates of the king closed behind them with a clang .