Avoid key cancellation at the end of line on Lilypond

I am working on the LMGx, the second stage of the Let's Musicise project. There are 15 lessons in that cycle, working on lesson 13, which at the moment consists of voice 1, voice and drums. I am working on Lilypond (2.18) notation program, using Frescobaldi UI. There are key changes for voice 2, and the key changes appear at the end the line. I used to search earlier for a solution and didn't find it, but today I managed, using the commands:

\override Score.KeyCancellation.break-visibility = #'#(#f #t #t)
\set Staff.explicitKeySignatureVisibility = #end-of-line-invisible

Attached is a pdf with the result.