Moved JID serialization functions into mod_mam_utils.
Fixed MySQL connection leakage with dedicated connections. Made dedicated connections truly dedicated (do not register them).