Fix sys_halt_internal implementation and issues with RTCs closing when they shouldn't