By chance, just to rule it out, have you tried a different keyboard?
Going off of Weeve's post, if a sleep (or heavy processing) happens before the if statement that's checking for the window closed, that might be causing it -- but I don't think this would be the case if the minimal code you posted still causes the same results.
sleep used to "simulate" heavy processing which causes me to have to hit enter twice most of the time.
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
}
}
_sleep(500);
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Return)) {
window.close();
}
window.clear();
window.display();
}
return EXIT_SUCCESS;
}