Fixed racecondition for opening