Remove usage of $this inside closure.