Have you checked your tablet to see how the "keep wifi on" settings are set? If you go into your settings for wifi you should see an option for keeping the wifi on while the screen is asleep.
Hopefully that will resolve the problem.
If not, it may be on the wifi end and not on your tablets end. If the wifi goes out at any point, this could cause the tablet to need to reconnect.