Extracted "close window unless dirty" method

into `CommonOperations` in an attempt to follow Jared's advice while
implementing <C-w>c as `:close` for #1488.
Fix #1488: implement <C-w>c like :close
Merge pull request #1517 from Kazark/fixes-1488

Fixes #1488: <C-w>c should close the current window