Close temporary file used in going to declaration

Similar to an issue in the last pull request.