Fixed #80 and #81

Closing the upload modal during an upload resulted in losing track of files being uploaded. Also new files couldn't be uploaded in the meantime.

I also did a little bit of refactoring to clean things up but it's far from being perfect.

Current implementation's major drawback is that if you add 40 folders at the same time, files will not be uploaded 5 by 5  but 5 by 5 for each 40 folders, which makes something like 200 by 200 (naive computation, it just stands as an example).
could you add parenthesis to make it clear about what is mulitplied.