[BUGFIX] Invalid SQL result after four login failures

sql_free_result is called too early.
Move the call after the error handling at the end of the method.

Fixes: #45996
Releases: 6.0, 6.1
Change-Id: I54f1edb48e4c3b70629b46cbba365416c01c0917
Reviewed-on: https://review.typo3.org/18579
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Mattias Nilsson
Tested-by: Mattias Nilsson
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-on: https://review.typo3.org/18583