Make project close and plugin shutdown save (scala) project-specific preference stores as well.

Fixes #1002304, #1002243
Merge pull request #838 from huitseeker/issue/1002304

Project close & plugin shutdown save project-specific preference stores