Fix order of operations in close() (although this still leaves open the question of why close() is being called when nothing is open).
Fix order of operations in close() (although this still leaves open the
question of why close() is being called when nothing is open).

Fixes #4440.

git-svn-id: 674a2d6b1e32e53f607eb824547723f32280967e@10703 560b804f-0ae3-0310-86f3-f6aa0a117693

harbalk/delite,Sam-Cummins/delite,kitsonk/delite,kitsonk/delite,harbalk/delite,Sam-Cummins/delite