Always close stream in readPreferences(). Fixes #729.
Merge pull request #730 from stefanbirkner/issue-729

Always close stream in readPreferences(). Fixes #729.