fix dangling db transactions in api