Make sure last generated key is retrieved before statement or connection or anything is closed