Magento not showing error messages on login page after redirect from cart-Collection of common programming errors

I added a redirect to checkout/onepage.phtml to redirect customers to the login/register page before proceeding to checkout from the cart. I did not modify Accountcontroller.php or login.phtml.

The redirect works fine, but the error messages on the login page get lost (e.g. wrong password, unknown email address are not showing up). The messages on the other pages work fine, and the messages on the login page only start to work again after deleting the cookies.

The code I use for the redirect at the beginning of onepage.html:

      if (!$this->helper('customer')->isLoggedIn()) {
             header("Location: /customer/account/login/");
             exit();
      }

In login.phtml is called correctly.

I also tried extending the redirect code with

Mage::getSingleton('core/session')->addError("Error message");
session_write_close();

which displays the message directly after the redirect and not when a wrong password/email is entered. Is there a way to make the messages work without creating a custom controller/module?