Lifeguard shortages closed thousands of pools and beaches during the COVID-19 pandemic, when social distancing requirements disrupted training and rising wages lured some workers to other summer jobs.