Switching multiple DB and mysql_close Do we need to call mysql_close(); before switching the database using                db_set_active('sharedb');?
No, you should not call any mysql functions at all. You don't mention the drupal version, but in 6, it's likely that you're actually using the mysqli extension and in 7, you're using PDO.

I don't think that a handful open database connections is going to be a problem, they will be automatically closed by the end of the request. So unless you have a long-running process or more than a handful connections you need to make, I wouldn't worry.

If you have either of those, then you might need to care about this, if you're on 7.x, there's an API for this: Database::closeConnection().

On 6.x, you're not so lucky, while you could check global $db_type (see db_set_active()), and call the right function, you also need to pass global $active_db to the function to close the right connection and you can't update $db_conns in db_set_active(), so that will not know that you closed the connection and you can't re-open the connection again.