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