Agios 325

- Replace invalidateAndCancel by finishTasksAndInvalidate to trigger releasing of resources after task completed
- add one unit test
- I also notices JSONRequestSerializer for an empty file in commit history, so put back its initial content + addintional test for releasing

@cvasilak do you mind reviewing?