Fix a hangup when cancelling exporting a PNG image
We should unlock the locks when cancelling the operation
Fixes T7194