Fix for extstorage + encryption where unencrypted size is not kept

Fix for external storage with encryption where the unencrypted size is
first written in the DB, then set back to zero, causing performance
issue because the file needs to be reopened every time to find out the
unencrypted size (and potentially needs a full redownload)

Please review @schiesbn (we debugged this together) @DeepDiver1975 @karlitschek