Make sure generated files are closed before we try to use them