Improve error handling and force draining pool when destroy resource.
End mysql pool when finish.