Fixed bug "Stream is closed" while uploading media.