Tesla turned its first profit in more than two years, and delivered a record number of cars