You can force Openfire to send a disconnect XMPP Ping message before it disconnect the client, assumed that your client will respond back to that disconnect message, that should keep your client connected.
This can be done by configuring Client Connections Idle Connections Policy under Server Settings. by setting the x seconds for "Disconnect clients after they have been idle for" and check "Send an XMPP Ping request to idle clients".