Check if an arbitrary FILE* has been opened before closing it.