check if iTerm2 is closed before replacing preferences