added small fix to avoid last file staying open