Fixes #1871, close implicit objects in implicit returns