@@ -1068,6 +1068,7 @@ export function updateInstanceConfig(
10681068 if ( readBuff . every ( v => v === 0 ) ) {
10691069 throw new Error ( 'Corrupted file' ) ;
10701070 }
1071+ newFile . close ( ) ;
10711072 await fs . rename ( tempP , p ) ;
10721073 } ;
10731074
@@ -2232,6 +2233,7 @@ export function downloadInstance(instanceName) {
22322233
22332234 await dispatch ( removeDownloadFromQueue ( instanceName ) ) ;
22342235 dispatch ( addNextInstanceToCurrentDownload ( ) ) ;
2236+ await remove ( tempInstancePath ) ;
22352237 } catch ( err ) {
22362238 console . error ( err ) ;
22372239 // Show error modal and decide what to do
@@ -2243,8 +2245,6 @@ export function downloadInstance(instanceName) {
22432245 isUpdate
22442246 } )
22452247 ) ;
2246- } finally {
2247- await remove ( tempInstancePath ) ;
22482248 }
22492249 } ;
22502250}
@@ -2704,12 +2704,15 @@ export const startListener = () => {
27042704 ! changesTracker [ completePath ] . completed &&
27052705 ( event . action === 2 || event . action === 0 || event . action === 1 )
27062706 ) {
2707+ let filehandle ;
27072708 try {
27082709 await new Promise ( resolve => setTimeout ( resolve , 300 ) ) ;
2709- await fs . open ( completePath , 'r+' ) ;
2710+ filehandle = await fs . open ( completePath , 'r+' ) ;
27102711 changesTracker [ completePath ] . completed = true ;
27112712 } catch {
27122713 // Do nothing, simply not completed..
2714+ } finally {
2715+ await filehandle ?. close ( ) ;
27132716 }
27142717 }
27152718 } )
@@ -3762,6 +3765,7 @@ export const checkForPortableUpdates = () => {
37623765 if ( err ) {
37633766 reject ( err ) ;
37643767 }
3768+ destination . close ( ) ;
37653769 resolve ( ) ;
37663770 } ) ;
37673771 } ) ;
0 commit comments