---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-74-15df25b9b003> in <module>()
23 semaphore = asyncio.Semaphore(4)
24 download_tasks = (download(url, filename, session, semaphore) for filename, url in pdfs.items())
---> 25 result = loop.run_until_complete(asyncio.gather(*download_tasks))
/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py in gather(loop, return_exceptions, *coros_or_futures)
594 for arg in set(coros_or_futures):
595 if not futures.isfuture(arg):
--> 596 fut = ensure_future(arg, loop=loop)
597 if loop is None:
598 loop = fut._loop
/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py in ensure_future(coro_or_future, loop)
517 if loop is None:
518 loop = events.get_event_loop()
--> 519 task = loop.create_task(coro_or_future)
520 if task._source_traceback:
521 del task._source_traceback[-1]
/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py in create_task(self, coro)
280 Return a task object.
281 """
--> 282 self._check_closed()
283 if self._task_factory is None:
284 task = tasks.Task(coro, loop=self)
/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py in _check_closed(self)
355 def _check_closed(self):
356 if self._closed:
--> 357 raise RuntimeError('Event loop is closed')
358
359 def _asyncgen_finalizer_hook(self, agen):
RuntimeError: Event loop is closed