Added task unlocking on window unload.