only release connection if successful