Python: ftp file stuck in buffer?
===

When I download a file with ftplib using this method:

    ftp = ftplib.FTP()
    ftp.connect("host", "port")
    ftp.login("user", "pwd")
    size = ftp.size('locked')

    def handleDownload(block):
        f.write(block)
        pbar.update(pbar.currval+len(block))
    
    f = open("locked", "wb")
    pbar=ProgressBar(widgets=[FileTransferSpeed(), Bar('>'), ' ', ETA(), ' ',    ReverseBar('<'), Percentage()],     maxval=size).start()
    ftp.retrbinary("RETR locked",handleDownload, 1024)
    pbar.finish()

if the file is less than 1mb the file will be stuck in the buffer until I download another file with enough data to push it out. I have tried to make a dynamic buffer by dividing the ftp.size(filename) by 20 but the same thing still happens. So how do I make it so I can download single files less than 1 mb and  still use the callback function?