who wrote the song purple rain for prince