Incorrect error message for out of order SAM file alignments
A minor regression introduced as part of #1599
The SAMSortOrderChecker https://github.com/samtools/htsjdk/blob/c6729bb302d0efd74734929270c6fe857227ffd4/src/main/java/htsjdk/samtools/SAMSortOrderChecker.java#L44-L54 sets the prev record as part of doing the isSorted test.
SAMFileWriterImpl used to get the "previous" record before doing isSorted so that the correct sort key was used in the error message. See: https://github.com/samtools/htsjdk/blob/99548ced8e594cd1c06f2c72167f50d45871b9a7/src/main/java/htsjdk/samtools/SAMFileWriterImpl.java#L191-L199
Now https://github.com/samtools/htsjdk/blob/c6729bb302d0efd74734929270c6fe857227ffd4/src/main/java/htsjdk/samtools/SAMFileWriterImpl.java#L206-L214 it gets the "previous" record after doing isSorted, by which time the value returned is no longer the actual previous record (and is always the same as alignment).