Possible fix for issue where flags are not being updated by inbox_new_flag

Hopefully closing the transaction before we send off the tasks will sort it out :)