Fixed preferences.

Fixed proper path on folder selection in the preferences form. Fixed
proper saving (the stream writer didn't close so it didn't save). Fixed