High School High Jinks

A prankster starts at locker #1, and flips its state from open to shut. He then moves one locker to the left (to #2017), and flips its state from open to shut. He then moves three more lockers to the left (to #2014), and flips its state from shut to open. He then moves five more lockers to the left (to #2009), and flips its state from open to shut. He keeps going in this way, until he has flipped a total of 2017 lockers.
How many lockers are open after he is finished?