null check before the close