try with resources might be better here?