Fix a bug when closing a directory.
Fix a bug when closing a directory.

We do not open a resource on a directory when opening, so avoid an error
when closing.

vcgato29/Central,Grummfy/Central,Metalaka/Central,Metalaka/Central,Grummfy/Central,vcgato29/Central