New York and New Jersey under states of emergency amid heavy rain and flooding