Fix writing the checksum before closing the sstable.

Patch by Sankalp Kohli, reviewed by Benedict for CASSANDRA-7285