Fixed failing to clean up open connections on exception path.