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

Fixes #6540

Cannot be tested until https://github.com/owncloud/core/issues/7630 is merged.
Note: I developed this against stable6 so I'd be able to test.
Will need re-testing.

CC @ser72