Add null check for optional closure.