Prevent a possible resource leak under race

Change-Id: I68bd3e5a2e5ba207e4942bfc4221798afaa1ba10