Connections are persistent for the time the script runs. A connection is established the first time needed and will be closed when the script ends. Since PHP is a scripting language and the process ends when reaching the end of the script it's not possible to keep up a connection during the whole session. But I don't think that connecting to the IMAP server is what takes much time.
Maybe it's a minor thing after all. And since there doesn't seem to be anything for this, for example in PHP's imap library, I guess it's not a big problem... but I guess it would be possible to do it at that level.
For this reason there are a few IMAP proxy daemons that will maintain and reuse existing IMAP connections. They do make a difference. I use the one from http://www.imapproxy.org/
I find that often the setup and disconnection phases of making a network transfer are often a large percentage of the time take for smaller transfers (obviously the longer time connected the less impact this has). Enabling persistent IMAP connections in (for example) Thunderbird speeds up IMAP access massively. So, if there is a way to integrate persistent connections (such as the previously mentioned IMAP Proxy) then I'd be all for it. It should be easy to have it an option on the settings so that is the flag use_proxy is set and the proxy daemon is not running, then it is started.
Jeff