Clean up code and remove JDBC resource leaks