we need this in line 466 too (`if (status === 'pending')`)

You should probably make a function from these 3 lines, like "closeIfSystemMessage" or something