Closing the temporary file before notifying about upload completion
(fixes a race condtion).