I didn't had time to look into this method but you should probably make sure that all opened files are closed.