Amazon filed a federal lawsuit Friday against New York Attorney General Letitia James to head off legal action over the company’s handling of coronavirus conditions at its Staten Island warehouse.