Match real palette format in ImagePalette.save()

The codes assumed that palette data was splitted into 3 parts in an array in the following sequence: 
[r(0), r(1) .. r(255), g(0), g(1), ... , g(255), b(0), b(1), ... ,b(255) ]. But the real format of this array was [r(0),g(0),b(0),r(1),g(1),b(1),...].
I rewrote the save() method to match the format de facto.
according to __init__, using `len(self.mode)` instead of magic number `3` might be better.