# Serial port left open when sketch program closed

**URL:** <https://discourse.processing.org/t/serial-port-left-open-when-sketch-program-closed/28592>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [March 16, 2021, 8:06pm UTC](https://discourse.processing.org/t/serial-port-left-open-when-sketch-program-closed/28592 "2021-03-16T20:06:13Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 17, 2021, 11:35am UTC](https://discourse.processing.org/t/serial-port-left-open-when-sketch-program-closed/28592/3 "2021-03-17T11:35:45Z")

</div>

Hello,

I also came across this topic:

> [@Can I interrupt a closing of a sketch to save data?](https://discourse.processing.org/t/can-i-interrupt-a-closing-of-a-sketch-to-save-data/16231):
>
> Hello all, Can I interrupt a closing of a sketch to save data? When Alt-F4 is pressed or the cross in the window is clicked (OS = Windows), the program closes. I would like to interrupt this, to save a file that the user changed. I this possible? Thanks! Regards, Chrisir P.S. This belongs to the project: [Can I make a small windows app for taking time and log production times?](https://discourse.processing.org/t/can-i-make-a-small-windows-app-for-taking-time-and-logg-production-times/15484/13)

I have NOT tested it but it may have potential for adding a clean exit (saving data, closing serial port etc.) to sketches.

`:)`

---

_[View the full topic](https://discourse.processing.org/t/serial-port-left-open-when-sketch-program-closed/28592)._
