The following worked for me on my Nexus 5.
Just toggle the "Keep Wi-Fi on during sleep" setting:
* Go to Settings > Wi-Fi
* Tap the ellipsis at top-right to access the Wi-Fi menu and then tap Advanced
* You will notice "Keep Wi-Fi on during sleep" and it may be set to "Always"
* Tap it and...