Fix some rtc bugs, halt when last shell is closed