Check if prefs file exists to avoid overwriting it

Since the Code Editor depends on the prefs file for project listing, if the prefs file is deleted, there are some -- but not all -- cases where un- and reinstallation of the code editor results in well-established projects having files that don't show up in the projects view (very common in the Dev channel). So, as a temporary solution: Don't write to the prefs file if it already exists! Instead, only write the prefs file if a NOT_FOUND_ERROR is caught trying to read it.

Also, there's no need for two duplicate onwriteend handlers, one within another! One is good enough.