It is probably not unlocking because the drivetrain is bound up. Backing up or inducing some wheelspin just before taking it out of 4WD will unbind the drivetrain and allow it to disengage.