Commiting changes to db on connection close