check if current buffer is dirty before save