Added utility method to close connection