Nonlocality, closing the detection loophole, and communication complexity