title: Python won't close excel workbook
body: <p>After I run the code, I cannot seem to open the generated excel file, because my computer says it is &quot;open in another program&quot;. If I close python, then I can open it.</p>
  <p>When I try to add &quot;workbook.close()&quot; to the code, I get the error &quot;Calling close() on already closed file.&quot; So it seems python already closed it.</p>
  <p>What can I do to be able to see my outputs without having to close python?</p>
  <pre><code>import pandas as pd
  
  # Import data
  df = pd.read_excel (r'C:\Users\Desktop\work\charts\constraints.xlsx' , sheet_name='biggestobstacle')
  print (df)
  
  
  # File 2 is the new excel table with the chart. Hence, we keep the originals untouched. We create a new excel + chart.
  writer = pd.ExcelWriter(&quot;file2.xlsx&quot;, engine=&quot;xlsxwriter&quot;)
  df.to_excel(writer, sheet_name='biggestobstacle')
  
  # Get xlsxwriter objects
  workbook = writer.book
  worksheet = writer.sheets['biggestobstacle']
  
  # Create a 'column' chart
  chart = workbook.add_chart({'type': 'column'})
  # select the values of the series and set a name for the series
  chart.add_series({
      'values': '=\'biggestobstacle\'!$B$2:$B$8', 
      &quot;name&quot;: &quot;My Series's Name&quot;
  })
  # Insert the chart into the worksheet in the D2 cell
  worksheet.insert_chart('D2', chart)
  
  writer.save()
  
  # This last line generates an error.
  workbook.close()
  </code></pre>