Release the page lock if the user clicks the cancel button

Fixes #741