Tweaks to error handling when closing JDBC connections