Add close() check