The level will end successfully as soon as you submit a word which clears the final cards from the board.
The level will never automatically fail; you have to decide that you are unable to complete the level. You can then either:
(1) Tap the "End Game" button that appears when you have flipped the last Draw Pile card; or
(2) Tap the button with the gear icon, in the lower left corner, then select "Quit to home" from the menu.
In both cases, you will lose one life (Heart).