Always remove the session when running check_db_up_to_date()

This commit sponsored by Francois Marier.  Thank you!
Raw image mediatype had a non-unicode logging call

Was causing UnicodeDecodeError when file/folder was not ascii.
Fixes bug #935.