Fixed wrong mode of gif image.

In case of initial L mode of Image and if it is small optimizations will not be performed. As a result mode will not change and will be L, but rawmode == P.
So comment:

  # When the mode is L, and we optimize, we end up with
  # im.mode == P and rawmode = L, which fails.
  # If we're optimizing the palette, we're going to be
  # in a rawmode of P anyway.

is wrong when image has L mode and small enough to pass optimizations.