adjusted createCheckpointAndClose