sample how to check for pending CanClose