Unregister file only after it was closed

Just in case we attempt to read just at that time