Changing FileSystem class to write to files before truncating them.

   - This will allow it to be used with cordova implementations that do not
support truncating empty files