Changes to help with debugging. 

I did not have a BED file for testing, but I suspect that you were trying to save an empty sequence.