Fixed bug with the save_response_to_file option.
diff --git a/README b/README
index 42173fe..163d14c 100644
--- a/README
+++ b/README
@@ -18,7 +18,7 @@
 
 Comments to : Chandrashekhar.Mullaparthi@gmail.com
 
-Version : 2.1.3
+Version : 2.1.4
 
 Latest version : git://github.com/cmullaparthi/ibrowse.git
 
@@ -51,6 +51,7 @@
 Peter Kristensen
 Ram Krishnan
 Richard Cameron
+Ryan Zezeski
 Sean Hinde
 Seth Falcon
 Steve Vinoski
@@ -61,6 +62,11 @@
 
 CONTRIBUTIONS & CHANGE HISTORY
 ==============================
+09-02-2011 - v2.1.4
+             * Fixed a bug reported by Ryan Zezeski with the
+               save_response_to_file option.
+               https://github.com/cmullaparthi/ibrowse/issues#issue/33
+
 16-01-2011 - v2.1.3
              * Fixed issues with streaming and chunked responses when using
                the 'caller controls socket' feature. See following links for
@@ -297,7 +303,7 @@
 12-01-2007 -  Derek Upham sent in a bug fix. The reset_state function was not
               behaving correctly when the transfer encoding was not chunked.
 
-13-11-2006 -  Youns Hafri reported a bug where ibrowse was not returning the 
+13-11-2006 -  Youns Hafri reported a bug where ibrowse was not returning the 
                 temporary filename when the server was closing the connection 
                 after sending the data (as in HTTP/1.0).
               Released ibrowse under the BSD license
@@ -316,7 +322,7 @@
 22-Nov-2005 - Added ability to generate requests using the Chunked 
               Transfer-Encoding.
 
-08-May-2005 - Youns Hafri made a CRUX LINUX port of ibrowse.
+08-May-2005 - Youns Hafri made a CRUX LINUX port of ibrowse.
               http://yhafri.club.fr/crux/index.html
 
 Here are some usage examples. Enjoy!
diff --git a/src/ibrowse.erl b/src/ibrowse.erl
index f70f92f..d219212 100644
--- a/src/ibrowse.erl
+++ b/src/ibrowse.erl
@@ -7,7 +7,6 @@
 %%%-------------------------------------------------------------------
 %% @author Chandrashekhar Mullaparthi <chandrashekhar dot mullaparthi at gmail dot com>
 %% @copyright 2005-2011 Chandrashekhar Mullaparthi
-%% @version 2.1.3
 %% @doc The ibrowse application implements an HTTP 1.1 client in erlang. This
 %% module implements the API of the HTTP client. There is one named
 %% process called 'ibrowse' which assists in load balancing and maintaining configuration. There is one load balancing process per unique webserver. There is
diff --git a/src/ibrowse_http_client.erl b/src/ibrowse_http_client.erl
index 7d606e6..edf76e6 100644
--- a/src/ibrowse_http_client.erl
+++ b/src/ibrowse_http_client.erl
@@ -1278,7 +1278,12 @@
                        reply_buffer  = RepBuf,
                        recvd_headers = RespHeaders}=State) when SaveResponseToFile /= false ->
     Body = RepBuf,
-    ok = file:close(Fd),
+    case Fd of
+        undefined -> 
+            ok;
+        _ -> 
+            ok = file:close(Fd)
+    end,
     ResponseBody = case TmpFilename of
                        undefined ->
                            Body;