This Android service will turn your Wi-Fi off when no application is actively using Wi-Fi for a certain amount of time while the screen is off.
The service assumes that if Wi-Fi data transfer rate is less than 64KiB per minute for 15 minutes in a row then there's no application that actively uses Wi-Fi.
Also this app can turn Wi-Fi off if there's no signal for 1 minute.
Google Play page:
https://play.google.com/store/apps/details?id=net.alkatrazstudio.wifiidletimeout