If you are inactive on WhatsApp Web for more than 30 minutes, you will automatically logged-out. While signing with WhatsApp Web, tick on the check box under the QR code that says keep me signed in.