If you find that the PuTTY window closes itself after a few minutes of inactivity, there is a setting change you can make to prevent this.
When PuTTY starts, click on ‘Connection’ on the left hand side, then change the entry ‘Seconds between keepalives (0 to turn off) from the default of 0 to 5.
*Caveat: You will now require to manually close the connection, as PuTTY will send null packets to the host to prevent it timing PuTTY out due to inactivity - unless the host has a maximum session timeout or a loss of network connection.
To keep the setting on future PuTTY sessions, click ‘Session’ on the left, click ‘Default Settings’ then press the ‘Save’ button.