added logic to remove sleep after last picture is taken