Fix login error handling + log file cleanup