#vulnerable code 
                                @Test
    public void testSelectDependsOnOnSingle() {
        Database db = db();
        Single<Long> a = db.update("update person set score=100 where name=?") //
                .parameter("FRED") //
                .counts().count();
        db.select("select score from person where name=?") //
                .parameter("FRED") //
                .dependsOn(a) //
                .getAs(Integer.class)//
                .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) //
                .assertValues(100) //
                .assertComplete();
    } 
                            #location 5 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                @Test
    public void testSelectDependsOnOnSingle() {
        try (Database db = db()) {
            Single<Long> a = db.update("update person set score=100 where name=?") //
                    .parameter("FRED") //
                    .counts().count();
            db.select("select score from person where name=?") //
                    .parameter("FRED") //
                    .dependsOn(a) //
                    .getAs(Integer.class)//
                    .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) //
                    .assertValues(100) //
                    .assertComplete();
        }
    }