Release db connection after error