Let $f: X\to Y$ be a morphism between arbitrary schemes. It is proved in EGA IV Prop 2.4.6 that if f is flat and locally of finite presentation, then f is open. If one replaces locally of finite presentation by locally of finite type, I don't think that the statement is still true (unless X and Y are locally noetherian) but I don't know of any counterexample.
There are absolutely flat rings $A$ (i.e. every $A$module is flat) with nonisolated (automatically closed) points $x$ in the spectrum. Then take the inclusion $x\to \mathrm{Spec}(A)$. Examples of such rings are ($k$ being any field):
• infinite products of fields, e.g. $k^\mathbb{N}$: you get a nontrivial maximal ideal from any nonprincipal ultrafilter on $\mathbb{N}$,
• the ring of locally constant $k$valued functions on any (infinite) totally disconnected compact Hausdorff space $Y$: then it is a classical exercise that the spectrum is $Y$.
Over a field $k$, another related (and somehow more algebraic) example is the "universal" $k$algebra $A$ generated by countably many orthogonal idempotents. In other words $A$ is the $k$algebra obtained as the quotient of the polynomial ring $k[X_1,X_2,...]$ in countably many variables, by the ideal generated by all polynomials $X_i^2X_i$ and $X_iX_j$ for $i\ne j$. It is easy to see that the maximal ideal $m=(X_1,X_2,...)$ gives a nonisolated closed point of $Spec(A)$. Moreover the local ring $A_m$ is just $k$, so that the closed immersion $i:Spec(A/m)\to Spec(A)$ is flat (the extension of local rings is an isomorphism). Thus it is a flat, finite type, morphism which is not open.

$\begingroup$ I had not thought about this one before, but in fact it is an instance of "my" second series of examples, the space $Y$ being the onepoint compactification of
$\mathbb{N}$
. Indded,$X=\mathrm{Spec}(A)$
is the subset of$k^{\mathbb{N}}$
consisting of the origin $O$ plus the natural basis $B$ of$k^{(\mathbb{N})}$
. It is easy to see that the Zariski topology on $B$ is discrete, $O$ is a limit point, and $A$ is canonically the ring of locally constant $k$valued functions on $X$. $\endgroup$ – Laurent MoretBailly Mar 25 '11 at 7:50 