Prevent data corruption when using transactions

This is one of Prawn's most annoying bugs, and it's time we work on fixing it (work-in-progress)