Many Mac users have have problems keeping their uploads and downloads alive when they walk away from the computer. This has been an issue since at least Mountain Lion (OS X 10.8). Since the bug only affects a small subset of users, and their setups vary, it’s been hard to track down and fix. The bug can cause both wifi and ethernet connections to be dropped.
The various Apple user forums have offered all kinds of possible solutions: Using an extra DNS, running Terminal commands, rebuilding network preferences and more. For some, these workarounds do the trick, but others are left exactly where they started. There’s a much easier way, and you don’t have to become a power user to get it to work.
Keep in mind that this solution won’t enable your Macbook to keep running with the lid closed. It won’t keep your connection alive while using battery power, especially if the charge is low. But if your computer is plugged in, and you want to do something else (like sleep), this’ll do the trick.
Your hero is a tiny Mac app called Caffeine, and it’s freeware! Lighthead Software released this beauty in 2010, and it hasn’t been updated since, but no worries… It’s working just fine on my El Capitan (OS X 10.11) machine. The software places a coffee cup icon in your top right menu bar. When the cup is empty, it’s off. When the cup is full, it’s on. You can set it for durations of 5 minutes to indefinitely.
Check it out here. And good luck! I hope this solves your problem, and has you downloading and uploading again without hiccups.