Add safe close.