Fix temporary image file creation

The current implementation of `show(image)` in `pylearn2/utils/image.py` causes an EBADF
(Bad file descriptor) error on some environments such as Mac OS X 10.8.0.
This is because invocation of `file.flush()` for a file opened with *read-only* mode may cause the
EBADF error in some environments.

This pull request re-implements the function with `tempfile.mkstemp()`.
It also resolves a race condition which may occur on Python older than 2.7.