Using the 'reconnect=1' option you can arrange for the connection to be closed after each API command. Without this option, the connection is left open until the logout process is completed.