FIX: Close sax parser before emitting the end event.

The reason why this patch is because on the "end" event, the event handlers are removed and since the method "end()" of the parser can emit the "error" event if the xml document is not closed correctly, the "error" event is not caught and the program exits with this error.
NEW: Update ftp to v0.3.1.