Checkpoint shared storage when inputs are returned (#4497)