Add flycheck-buffer-saved-p

Extract the buffer-modified-p dance into a common function