No - you do not always give it back immediately in many cases as you have a transaction, which cannot "change hands". If a write connection makes consecutive updates to the DB, you must see it through before closing.
I meant you give it back immediately when you're done with it. So usually after you commit, unless you want to hold it longer for some special reasons.