Always remove the session when running check_db_up_to_date()

This commit sponsored by Francois Marier.  Thank you!
Add new hook 'add_media_to_collection'