Use autocloseable in try with resources.