Fixed chunking and insufficient storage check

- fixed free space detection based on the already uploaded chunks
- now deleting chunks as soon as it is read out before writing it into
  the part file, which reduces the space needed when assembling part
files

Backport of 4033eba from master