Fix write_lock being help on db when postimport plugins are run