Commissioning and performance of the CMS pixel tracker with cosmic ray muons