arq5x/bedtools2 — pull request #101 by mmendez12 (2014-07-31 08:32:21+00:00)
Title: Fix how bamtobed -bedpe handle the last read

When using bedtools bamtobed with the option -bedpe, if the last read in the bam file has no mate then the program still output a read based on the previously seen read.

Here is an example:

myreads.sam
```
...
nameA	\d	chr1
nameA	\d	chr1
nameB	\d	chr2	//eof
```

Command:
`bedtools bamtobed -bedpe -i myreads.bam`

Output:
```
chr1 ... nameA
chr1 ... nameA
```

Here I solved the problem by checking the return value of the GetNextAlignment function that is used to set the value of the variable bam2.