Introduce checkpoint handler
This change introduces a checkpoint handler which encapsulates the
setting and handling of checkpoint signals, and owns the bCPT boolean.
This cleans up the do_md loop, exchanging several lines of code by
a single command. It also makes a step towards a task-based design by
only calling the internal functions when necessary (if checkpointing
is enabled, signal setting only on master), and by owning as much
data as possible.
Refs #1793
Change-Id: I05ca7abc9e81c9a8deacb6b81086e1077524d005