It is traditional for pieces to end in the key in which they started; in the case of these pieces, however, the device Chopin used is called a Tièrce de Picardie, which is the conclusion of a minor piece with the tonic chord of the parallel major, and which originated in the Baroque era. It appears in quite a lot of pieces, of which the prelude BWV 999 is the one which leaps to mind for me, and is simply an interesting way to depart from the ear's expectation at the end of the piece.