More work on bug #8369.  I also made it possible to unlock the last locked payperiod for bug #8373.