Fix public upload to not close session when encryption is on

The encryption app needs to create keys when uploading files, so the
session needs to be kept open in such case.

@DeepDiver1975 @schiesbn @karlitschek