core: fix not closing statement resource leak

Fix a resource leak caused by not closing a statement by
adding a "try with resource" statement.
It was possible because Statement implements AutoCloseable.

Change-Id: Ibaeaa0c162bf9171a51e19ae95cf9689efd9fe04
Signed-off-by: Alissa Bonas <abonas@redhat.com>