17.Qxd7# is check mate. No the King cannot capture the Queen. Even though the Rook is pinned it still protects the Queen being taken by the King. If Kings were captured, then the first person to capture a King would win.
17.Qxd7+ Kxd7 18. Rxd7 game over
Could king kill white queen while black queen block white tower? https://www.chess.com/game/live/138733123910