Fixed uploaded files not being cleaned properly