Andy Murray has confirmed he will retire after the Olympics, saying Paris 2024 will be his "last ever tennis tournament".